Can not access elements of a configuration if the keys are numbers
geier1993 opened this issue · comments
What happened?
I have a YAML file that contains a map with integer keys, e.g.
8:
subMap;
1333534:
subMap:
The structure itself is meant to be generic, in my case I am refering to paramId
but it can be any other MARS key.
In the code I'm now iterating with
for (const auto& key: valueMap.keys()) {
auto val = valueMap.getSubConfiguration(key);
}
which should work for consistency.
However, in this case it will return an empty map and thus distorts the workflow.
To avoid the problem, I have to put strings as keys explicitly in the map:
"8": ...
"1333434": ...
Considering that the whole eckit::Configuration
is working with string keys and a valid YAML file may contain both keys (i.e. 8 and "8"), I think it is the right behaviour not to try to look up an int key.
However, it is also not failing with the expected "ConfigurationNotFound".
What are the steps to reproduce the bug?
Well...
Read a YAML file with eckit::YAMLConfiguration and iterate a map....
Version
develop
Platform (OS and architecture)
MacOS
Relevant log output
No response
Accompanying data
No response
Organisation
ECMWF
See answer by @tlmquintino in older closed issue #21 .
Configuration API does not support numbers as keys, even if YAML supports this.