From f4dc05a09dc6ab263d83985aaea805c3d8033886 Mon Sep 17 00:00:00 2001 From: Mauro van der Gun Date: Sat, 23 Dec 2023 22:39:54 -0400 Subject: [PATCH] improve validation interceptor documentation --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dd5d533..36cf133 100644 --- a/README.md +++ b/README.md @@ -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()