Repository navigation
Reject YAML keys that collide after JSON conversion - #20
Open
Aryangupta-05 wants to merge 1 commit into
Open
Aryangupta-05 wants to merge 1 commit into
Aryangupta-05 wants to merge 1 commit into
Conversation
Signed-off-by: Aryan <aryangupta050903@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
YAML scalar keys can be distinct in the decoded map but convert to the same JSON member name. For example,
0and.0both become"0". The conversion currently overwrites one value according to Go map iteration order, so enabling origin tracking can change the decoded document.Reject a collision before assigning to the converted string-keyed map. This intentionally rejects ambiguous inputs that previously lost data nondeterministically; distinct keys keep their existing behavior.
Tests cover the exact kin-openapi CI fuzz input, integer/string and boolean/string collisions, nested and sequence mappings, origin tracking on/off, YAMLToJSON, and noncolliding numeric/string controls.
Validation: full dependency suite with
go test -race ./..., vet, module verification and golangci-lint 2.14.0 pass on Windows/amd64, Go 1.27.3. Kin-openapi's exact failing seed13a4f64947658e0dpasses 100 repetitions with this dependency fix supplied through an isolated alternate modfile. A fresh 60-second FuzzLoadWithOrigins budget also passes (29,262 executions). No change to kin-openapi's published branch or dependency files is included.This is a separate dependency fix for https://github.com/getkin/kin-openapi/actions/runs/41282664333/job/124777580434. It does not by itself change that PR's CI result: the dependency must be reviewed, released and adopted first.