update model-validation section

Gerasimos (Makis) Maropoulos 2020-04-07 19:30:54 +03:00
parent adf5d2bd91
commit 388df26430
No known key found for this signature in database
GPG Key ID: 5DBE766BD26A54E7

@ -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.