Skip to content

Commit 8f685a6

Browse files
authored
Merge pull request #487 from CoolGoose/patch-1
explain ModelState validation option ValidateModelState
2 parents 374eca6 + e0ccca9 commit 8f685a6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

docs/usage/options.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ services.AddJsonApi<AppDbContext>(options => {
6161

6262
## Custom Query Parameters
6363

64-
If you would like to use custom query params (parameters not reserved by the json:api specification), you can set AllowCustomQueryParameters = true. The default behavior is to return an HTTP 400 Bad Request for unknown query parameters.
64+
If you would like to use custom query params (parameters not reserved by the json:api specification), you can set `AllowCustomQueryParameters = true`. The default behavior is to return an HTTP 400 Bad Request for unknown query parameters.
6565

6666
```c#
6767
services.AddJsonApi<AppDbContext>(options => {
@@ -78,3 +78,13 @@ If you want to change the default serializer settings, you can:
7878
options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
7979
options.SerializerSettings.ContractResolver = new DasherizedResolver();
8080
```
81+
82+
## Enable ModelState Validation
83+
84+
If you would like to use ModelState validation into your controllers when creating / updating resources you set `ValidateModelState = true`. By default, no model validation is performed.
85+
86+
```c#
87+
services.AddJsonApi<AppDbContext>(options => {
88+
options.ValidateModelState = true;
89+
});
90+
```

0 commit comments

Comments
 (0)