Repository navigation
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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.
Fixes #83.
Decoding
{"const":9007199254740993}currently changes the constant to9007199254740992. Consequently, validation rejects the original exact value and accepts the adjacent incorrect value. Enum constraints and nested constants have the same problem; values outside the float64 range cannot even be decoded.Use
json.Decoder.UseNumberfor generic schema values, including the separate explicit-null-awareConstpath. The existing exact numeric comparison code then receives the original constraint. Keep rejection of trailing JSON values and malformed input. No new dependencies, compatibility switches, duplicate validation representations, or public field type changes are introduced.Scope and compatibility
This complements #81 rather than duplicating it: #81 fixes instance type classification, while this change preserves the schema's own values before validation. The regression deliberately uses no
typekeyword and passes independently of #81.Numbers decoded into Const, Enum, Examples, and Extra now have dynamic type
json.Numberinstead offloat64. Callers assertingfloat64must adapt. Already-rounded floating-point instance values cannot recover their original JSON precision. This draft requests review of the behavioral compatibility change and release treatment.Concrete numeric fields such as Minimum, Maximum, and MultipleOf retain their current types and precision limitations. Instance classification and default application are not changed. This is not a claim of complete arbitrary-precision support throughout the validator.
Validation
1e400.go test ./...,go test -race ./...,go build ./...,go mod tidy -diff, formatting, andgit diff --checkpassed with Go 1.27.0 on darwin/arm64.go vet ./...andstaticcheck ./...report existing invalid/unexported JSON-tag fixtures and unused declarations. Both were also run against an unmodified archive of 794ce5e and produced the same diagnostics. No checks or assertions were disabled.Related downstream protocol-boundary fix: modelcontextprotocol/go-sdk#1311.