Skip to content

Add decode option that allows specific field prefixes#795

Merged
goccy merged 1 commit intogoccy:masterfrom
cpuguy83:allow_unknown_field_prefixes
Oct 21, 2025
Merged

Add decode option that allows specific field prefixes#795
goccy merged 1 commit intogoccy:masterfrom
cpuguy83:allow_unknown_field_prefixes

Conversation

@cpuguy83
Copy link
Copy Markdown
Contributor

This would be paired with DisallowUnknownField where you generally want to make sure the yaml does not have unknown fields, but allow for cases where the yaml has some extra stuff in it, e.g. for custom metadata or using fields as variables for anchors.

In our specific case we allow x-* fields for these cases.

Before submitting your PR, please confirm the following.

  • Describe the purpose for which you created this PR.
  • Create test code that corresponds to the modification

This would be paired with DisallowUnknownField where you generally want
to make sure the yaml does not have unknown fields, but allow for cases
where the yaml has some extra stuff in it, e.g. for custom metadata or
using fields as variables for anchors.

In our specific case we allow `x-*` fields for these cases.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@codecov-commenter
Copy link
Copy Markdown

⚠️ 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 78.00%. Comparing base (25e5d90) to head (becbbbe).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #795      +/-   ##
==========================================
+ Coverage   77.97%   78.00%   +0.02%     
==========================================
  Files          22       22              
  Lines        8108     8119      +11     
==========================================
+ Hits         6322     6333      +11     
  Misses       1370     1370              
  Partials      416      416              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cpuguy83
Copy link
Copy Markdown
Contributor Author

ping @goccy

@goccy
Copy link
Copy Markdown
Owner

goccy commented Oct 21, 2025

LGTM 👍

@goccy goccy merged commit 90e8525 into goccy:master Oct 21, 2025
25 checks passed
@cpuguy83 cpuguy83 deleted the allow_unknown_field_prefixes branch October 21, 2025 18:01
Madoxen pushed a commit to barney-ci/go-yaml that referenced this pull request Jan 27, 2026
This would be paired with DisallowUnknownField where you generally want
to make sure the yaml does not have unknown fields, but allow for cases
where the yaml has some extra stuff in it, e.g. for custom metadata or
using fields as variables for anchors.

In our specific case we allow `x-*` fields for these cases.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
wrouesnel pushed a commit to wrouesnel/go-yaml that referenced this pull request Feb 12, 2026
This would be paired with DisallowUnknownField where you generally want
to make sure the yaml does not have unknown fields, but allow for cases
where the yaml has some extra stuff in it, e.g. for custom metadata or
using fields as variables for anchors.

In our specific case we allow `x-*` fields for these cases.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
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.

3 participants