Open gburiola opened 6 years ago
Yes, duplicate keys are an issue to avoid. Let's implement it. One request - throw a warning (not error) and format it as "one line".
In the fix description, you can provide a notice, that with version 2.x the warning will be changed to "error". (I know we can control this by settings, however, idea: we can also rather say that since 2.x reclass will be more strict and will not want to keep full "backward compatibility" with the default settings.)
At the moment, reclass allows duplicate keys in any YAML file and silently uses the last value.
For example, this node file:
Returns the following:
In a very large YAML file, this is an easy to make mistake and can have very bad consequences.
We could use something like what's described in the link below to look for duplicate keys on
reclass/storage/yamldata.py
https://gist.github.com/pypt/94d747fe5180851196ebThat would throw an error on
yaml.load()
:If you're happy with this approach I'm happy to implement it.