-
Notifications
You must be signed in to change notification settings - Fork 40
Description
There are some places in https://yaml.org/spec/1.2/spec.html regarding mapping key duplicates:
1.3
Technically, YAML therefore complies with the JSON spec, choosing to treat duplicates as an error.
3.2.1.
Mapping nodes are somewhat tricky because their keys are unordered and must be unique.
3.2.1.1.
Mapping
The content of a mapping node is an unordered set of key: value node pairs, with the restriction that each of the keys is unique.
3.2.1.3.
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.
10.1.1.1.
Represents an associative container, where each key is unique in the association and mapped to exactly one value.
My understanding of above is: mapping key duplicate is an error.
On the other side there is a test for duplicates in the section VALID of YAML test matrix:
https://matrix.yaml.io/sheet/valid.html#2JQS
Depending on the real intetntion it should be clear specified:
- key duplicate is an ERROR and the test should be moved to INVALID
or - key duplicate is OK and the SPEC should be modified (above texts and precedence rules should be added)