iris
iris copied to clipboard
[BUG] Unable to attach Validator on iris Application
Describe the bug A clear and concise description of what the bug is. Unable to attach validator on iris Application instance.
app.Validator undefined (type *iris.Application has no field or method Validator)
To Reproduce Steps to reproduce the behavior: example here https://github.com/kataras/iris/blob/master/_examples/request-body/read-json-struct-validation/main.go
Expected behavior
A clear and concise description of what you expected to happen.
Validator should attach
Screenshots
Desktop (please complete the following information):
- OS: [e.g. ubuntu, windows]
iris.Version
- e.g. v12.2.0-alpha or master
Please make sure the bug is reproducible over the master
branch:
$ cd PROJECT
$ go get -u github.com/kataras/iris/v12@master
$ go run .
Additional context
Add any other context about the problem here.
Even if i use readJSON
to read the body with struct tags described in example, no error is thrown. validator is expected to run manually. Am i missing anything?
Realised that this feature is not yet released. Anyways thanks for making this package. i am starting using it for a new service. so alpha code is not yet merged in master? i am using "github.com/kataras/iris/v12"
try go get -u github.com/kataras/iris/v12@master
v12.2.0-alpha iris.go line:339
err := app.Validator.Struct(v)
if err != nil {
if !strings.HasPrefix(err.Error(), "validator: ") {
return err
}
}
while validate failed, but !strings.HasPrefix(err.Error(), "validator: ")
omit。