Skip to content

Conversation

@higuruchi
Copy link

Close: #174

Add warning when duplicate hashmap key

  • yaml

    key1: 
      a: "b"
    key1: 
      b: "c"
  • warning

    WARNING: Hash({String("b"): String("c")}) is duplicated
    

@puetzp
Copy link

puetzp commented Feb 4, 2022

Hey there, I wonder if insert_new_node should return a ScanError instead of a waning in case of encountering a duplicate key. It seems to me that the YAML 1.2 spec contains numerous sections that mention the requirement of key uniqueness in mappings, which would indicate a "hard" error.

@davvid
Copy link

davvid commented Jan 29, 2024

👍 on the above, and also note that since this is library code we shouldn't really be printing anything.

I'd be more than happy to accept a PR that makes duplicate keys an error in my fork: https://github.com/davvid/yaml-rust

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dupliacte keys are not detected as invalid YAML

3 participants