Open mr-c opened 6 years ago
I don't think this is a problem with CWL tbh. that's just how json/yaml is spec'ed, last values in a map take precedence. For example:
import json
json.loads('{"a": 1, "a": 2}')
>>> {'a': 2}
there is nothing abnormal with it
@itajaja While I agree that ignoring duplicate keys is not abnormal from a technical perspective, it is not good from a user experience perspective.
Actually, YAML considers duplicate keys an error. From http://www.yaml.org/spec/1.2/spec.html:
JSON's RFC4627 requires that mappings keys merely “SHOULD” be unique, while YAML insists they “MUST” be. Technically, YAML therefore complies with the JSON spec, choosing to treat duplicates as an error. In practice, since JSON is silent on the semantics of such duplicates, the only portable JSON files are those with unique keys, which are therefore valid YAML files.
and
Since YAML mappings require key uniqueness, representations must include a mechanism for testing the equality of nodes. This is non-trivial since YAML allows various ways to format scalar content. For example, the integer eleven can be written as “0o13” (octal) or “0xB” (hexadecimal). If both notations are used as keys in the same mapping, only a YAML processor which recognizes integer formats would correctly flag the duplicate key as an error.
Perhaps this should be considered a bug in ruamel.yaml? It should throw an exception, rather than silently ignoring all but the last entry.
To be clear, once we upgrade to the newer ruamel.yaml version then duplicated keys will be caught
Expected Behavior
Tell us what should happen
Validation error
Actual Behavior
Tell us what happens instead
No validation error
Workflow Code
Your Environment