mirror of
https://github.com/kataras/iris.git
synced 2025-03-13 22:36:24 +01:00
update model-validation section
parent
adf5d2bd91
commit
388df26430
|
@ -1,9 +1,9 @@
|
|||
Iris does not contain built-in method for validating request data such as "Models". However, you are not limited. In this example we will learn how to use the [**go-playground/validator.v9**](https://github.com/go-playground/validator) for request values validation.
|
||||
Iris, wisely, not features a builtin data validation. However, you are not limited. In this example we will learn how to use the [**go-playground/validator/v10**](https://github.com/go-playground/validator) for request values validation.
|
||||
|
||||
Check the full docs on tags usage [here](http://godoc.org/gopkg.in/go-playground/validator.v9#hdr-Baked_In_Validators_and_Tags).
|
||||
Check the full docs on tags usage [here](https://pkg.go.dev/github.com/go-playground/validator/v10@v10.2.0?tab=doc).
|
||||
|
||||
```sh
|
||||
$ go get gopkg.in/go-playground/validator.v9
|
||||
$ go get github.com/go-playground/validator/v10
|
||||
```
|
||||
|
||||
Note that you need to set the corresponding binding tag on all fields you want to bind. For example, when binding from JSON, set `json:"fieldname"`.
|
||||
|
@ -16,7 +16,7 @@ import (
|
|||
|
||||
"github.com/kataras/iris/v12"
|
||||
|
||||
"gopkg.in/go-playground/validator.v9"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// User contains user information.
|
||||
|
|
Loading…
Reference in New Issue
Block a user