gin-gonic / gin-gonic/examples
Might be a bug in the example custom-validation
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 4.6k
- Forks
- 726
- Avg merge
- 2h 23m
- Merged PRs (30d)
- 3
Description
Hi, in the example Custom validators,
(https://github.com/gin-gonic/examples/blob/3a0d22aa344fcf014612f43f5bf21f9c9997fd67/custom-validation/server.go#L32)
v, ok := binding.Validator.Engine().(*validator.Validate) returns v=nil and ok=false on my machine. Therefore the validator bookableDate would not be registered.
Environment:
Windows 10
Go 1.13
github.com/gin-gonic/gin v1.5.0
github.com/go-playground/validator/v10 v10.2.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with custom-validation/server.go around line 32 and reproduce the example using the reported Go, Gin, and validator versions. Check why binding.Validator.Engine() does not return the expected validator and verify that bookableDate is registered and used by the example. Done means the example runs with the custom validation enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100