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

Deserializing is not handling non-unique keys correctly #536

Closed
Khazuar opened this issue Oct 17, 2020 · 4 comments · Fixed by #750
Closed

Deserializing is not handling non-unique keys correctly #536

Khazuar opened this issue Oct 17, 2020 · 4 comments · Fixed by #750

Comments

@Khazuar
Copy link

Khazuar commented Oct 17, 2020

According to the YAML spec (and common sense) keys in YAML-mappings should be a set of unique values. I frequently encounter errors (originating from tiny typos of mine), where a document (or mapping within a document) like

fu: bar
fu: baz

is interpreted like

fu: baz

and the duplicate key issue is silently ignored.

Would it be possible to at least have an option to treat duplicate keys as deserialization errors?

@stan-sz
Copy link
Contributor

stan-sz commented Jan 18, 2023

Thanks @nuttytree. The current changes does not handle duplicate keys in DictionaryNodeDeserializer, is that intentional?
This is also related to #764

@EdwardCooke
Copy link
Collaborator

Most likely an oversight, on my part as well. I’m working on getting a new release out shortly. If you want to put in a pr with the needed changes for it I can try and get it in.

@nuttytree
Copy link

Yes, an oversite on my part. I have a task at work I committed to getting done today, I might still have time yet today to get a PR up, if not I will try to do it first thing in the morning.

stan-sz added a commit to stan-sz/YamlDotNet that referenced this issue Jan 20, 2023
Follow up on aaubry#536 and extend the functionality to `DictionaryNodeDeserializer`.
@stan-sz
Copy link
Contributor

stan-sz commented Jan 20, 2023

Hi @EdwardCooke and @nuttytree - please check out the linked PR I just sent. Thanks!

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

Successfully merging a pull request may close this issue.

4 participants