Skip to content

Commit

Permalink
improve validation interceptor documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdgun committed Dec 24, 2023
1 parent fdf12f7 commit f4dc05a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,15 @@ The `[AutoValidateNever]` attribute can be placed on a controller class, control

**Note:** Using validation interceptors is considered to be an advanced feature and is not needed for most use cases.

Validation interceptors allow you to intercept and alter the validation process by either implementing the `IGlobalValidationInterceptor` interface in a custom class or by implementing
the `IValidatorInterceptor` on a single validator.
During the validation process both instances get resolved and called (if they are present) creating a mini pipeline of validation interceptors:
Validation interceptors provide a mechanism for intercepting and modifying the validation process. This can be achieved through two distinct approaches:

Global validation interceptor:
Create a custom class that implements the `IGlobalValidationInterceptor` interface and register it with the service provider.

Per validator interceptor:
Implement the `IValidatorInterceptor` interface directly on a specific validator.

In the validation process, both the global and the validator interceptors are resolved and invoked (if they exist), thereby establishing a miniature pipeline of validation interceptors:

```
==> IValidatorInterceptor.BeforeValidation()
Expand Down

0 comments on commit f4dc05a

Please sign in to comment.