Skip to content
This repository was archived by the owner on Dec 2, 2024. It is now read-only.

allow strict parsing (to disallow key duplicates in mapping)#1

Closed
niamster wants to merge 2 commits intomasterfrom
dm/pstrict
Closed

allow strict parsing (to disallow key duplicates in mapping)#1
niamster wants to merge 2 commits intomasterfrom
dm/pstrict

Conversation

@niamster
Copy link
Copy Markdown
Collaborator

By default YAML parser ignores dupes, but it may be interesting to catch them and fail.

Example of failure for sample config

diff --git a/test/my-data.yaml b/test/my-data.yaml
index aa0f52f..2dcf546 100644
--- a/test/my-data.yaml
+++ b/test/my-data.yaml
@@ -1,4 +1,5 @@
 root:
   key1: value1
   key2: 1
+  key2: 1
 root2: test

Output:

panic: yaml: unmarshal errors:
  line 4: key "key2" already set in map

@niamster
Copy link
Copy Markdown
Collaborator Author

niamster commented Nov 9, 2023

All required changes are already synced from upstream.

@niamster niamster closed this Nov 9, 2023
@niamster niamster deleted the dm/pstrict branch November 9, 2023 09:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant