Parameter mapping and cascading do not work together sometimes
Opened this issue · 1 comments
When one datasource has a value defined in one style of parameter names and another in another it leads to values being "erased" from the final config.
E.g.
data class Config(
val mySection: MySection
) {
data class MySection(val test: Int, val subSection: SubSection) {
data class SubSection(val someValue: Int)
}
With a file config like this
my-section {
test = 1
sub-section {
some-value = 2
}
}
And an environment variable like this
mySection.subSection.someValue = 3
Will result in mySection.test
not being set.
I looked in the debugger and it seems that "mySection" and "my-section" are different paths when resolving config at the cascading stage, so "mySection.test" is undefined and that value overrides "my-section.test" that is set.
I don't know if it makes sense but if parameter mapping was applied already when preprocessing the configs so that the map has normalized names, and not at the point of reading from the map, it would prevent this kind of issue.
At least it might be worth noting in the docs that this is not allowed, because it's very hard to debug when it happens.