Repository navigation
Conversation
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.
An
intfield taggedenum:"1,2"currently generates{"type":"integer","enum":["1","2"]}. The numeric values fail the enum constraint, while the string values fail the type constraint. Boolean and floating-point fields have the same problem.Parse enum tags according to the generated field type so numeric and boolean values keep their JSON types. String enums remain strings, including values such as
"true"and"1". Integer parsing preserves the full signed/unsigned 64-bit range; number enums usejson.Numberto avoid introducing float rounding. Unparseable tags keep their previous string representation.The regression tests validate permitted and out-of-enum values through
ParseAndValidate, cover a pointer to a named integer type, and check exact serialization of large integer enums. The validation and integer-serialization regressions fail on the unchanged code and pass with the fix.Validation on Go 1.27.0, macOS arm64:
go test ./... -count=1 -timeout=30mpassed.go build ./..., gofumpt, andgit diff --checkpassed.-modfileand-mod=mod. Their checked-in module files reportgo: updates to go.mod neededon both the unchanged baseline and this branch; this PR changes no dependency files.Synced with main after #415 fixed the pre-existing
http2.GoAwayErrordeprecation. GitHub Actions lint now passes.