Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add warning when duplicate hashmap key #185

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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