@@ -665,13 +665,22 @@ This is only a validity requirement as enforcing this requires the
665665encoder to be aware of all map keys at the same time, which may be
666666particularly difficult to implement for streaming encoders.
667667The `lexicographic-map-sorting` encoding constraint does require such
668- awareness already as a prerequisite to sorting the entries by map key;
669- the check therefore becomes trivial, as multiple entries with the same
670- map key would be consecutive.
671- Given this opportunity, the encoding constraint therefore is
668+ awareness already as a prerequisite to sorting the entries by map key.
669+ In combination with the other CDE encoding constraints
670+ ` preferred-serialization` and `definite-length-only`, the check
671+ therefore becomes trivial : multiple entries with the same
672+ map key would have the same (deterministic) map key serialization and
673+ would therefore be consecutive when sorted.
674+ Given this opportunity, the `lexicographic-map-sorting` encoding constraint
675+ therefore is
672676deliberately phrased to require consecutive entries to have strictly
673- increasing map keys; this prevents encoding multiple entries that have
677+ increasing map keys; with the other CDE encoding constraints, this prevents
678+ encoding multiple entries that have
674679the same key.
680+ Note that {{Section 5.6.1 of RFC8949@-cbor}} lists one specific case
681+ " (specifically, -0.0 is equal to 0.0)" where two different keys are
682+ considered equivalent for the purpose of duplicate map keys; this
683+ needs to be checked with extra code for a full validity checker.
675684
676685
677686# CDDL support
0 commit comments