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

Support to disallow duplicate map key at parsing #531

Merged
merged 1 commit into from
Nov 13, 2024
Merged

Conversation

goccy
Copy link
Owner

@goccy goccy commented Nov 13, 2024

fix #226

Breaking Changes

Previously, using the same map key did not result in a parsing error, but from now on, it will throw an error by default. If you want to keep the previous behavior, specify the parser.AllowDuplicateMapKey() option. Similarly, during Decode, it will also throw an error by default. To keep the previous behavior, specify the yaml.AllowDuplicateMapKey() option when decoding.

Also, I deprecated yaml.DisallowDuplicateKey option. That is not necessary.

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.16%. Comparing base (4385176) to head (1cf609f).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #531      +/-   ##
==========================================
- Coverage   79.23%   79.16%   -0.07%     
==========================================
  Files          17       18       +1     
  Lines        6216     6245      +29     
==========================================
+ Hits         4925     4944      +19     
- Misses        977      985       +8     
- Partials      314      316       +2     

@goccy goccy merged commit 9c6665c into master Nov 13, 2024
18 checks passed
@goccy goccy deleted the duplicate-map-key branch November 13, 2024 09:29
@alexandear
Copy link
Contributor

Also, I deprecated yaml.DisallowDuplicateKey option. That is not necessary.

Hi, it looks like the yaml.DisallowDuplicateKey option was removed instead of being deprecated. According to Semantic Versioning, this constitutes an incompatible API change, which requires a major version increment.

In the future, please consider deprecating options with the comment first before removing them to maintain backward compatibility. For example, you can add the comment // Deprecated: use ... instead, and the IDE will highlight this function as deprecated.

Thank you!

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.

Duplicate keys in mappings don't cause parse error
3 participants