Repository navigation
docs: clarify number and numeric validation - #1701
Open
wozhenbang2004 wants to merge 2 commits into
Open
wozhenbang2004 wants to merge 2 commits into
wozhenbang2004 wants to merge 2 commits into
Conversation
Co-Authored-By: ChatGPT (GPT-6 Astra Pro)
Co-Authored-By: ChatGPT (GPT-6 Astra Pro)
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 Or Enhances
Fixes #940.
Clarify that
numberaccepts only ASCII digit strings, whereasnumericalso accepts signed and decimal strings. Both tags accept values with Go integer or floating-point types. The documentation now distinguishes the string"1.618"from the value1.618and explains the exponent restriction.Add a runnable
Validate.Varexample showing the two tags side by side. Validation behavior is unchanged; the example and the existingTestNumber/TestNumerictests pass before and after the documentation change.Validation with Go 1.27.4 on Linux:
go test -count=1 -v -run '^(TestNumber|TestNumeric|ExampleValidate_Var_numberAndNumeric)$' .passes.go vet ./...passes.golangci-lint run ./...passes with CI-pinned v2.13.1 and Go 1.26.11.TestUnixDomainSocketExistsValidation, because this environment rejects socket creation withoperation not permitted. The exact unmodified base produces the same failures; all 25 other packages pass.This change was prepared with AI assistance (ChatGPT, GPT-6 Astra Pro).
Make sure that you've checked the boxes below before you submit PR:
@go-playground/validator-maintainers