-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Open
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Componentsarea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-validationIssues related to model validation in minimal and controller-based APIsIssues related to model validation in minimal and controller-based APIs
Milestone
Description
Currently, the new shared validation support (used in Minimal APIs and Blazor) does not have a mechanism for declaring that some object properties of a validated type should be skipped (i.e. the validator should not recurse into validating their types and their nested properties).
We should add an opt-out attribute similar to the ValidateNever
attribute from MVC.
Name of the attribute is to be determined. We might want to avoid conflict with ValidateNever
. Notably, SkipValidation
is used as a property in JsonWriterOptions
.
Proposed features:
- When user decorates a property of a validated type with the attribute, the validator skips that property during validation.
- When user decorates a parameter of a validated method with the attribute, the validator skips the parameter during validation.
- [TBD] When user decorates a type with the attribute, the validator skips all properties and parameters of that type during validation. (
ValidateNever
supports this.) - The source generator skips creating validation code for a type/property/parameter that is only present in the assembly as decorated with the attribute. (If there is at least one use that is not skipped from validation, the code must be generated.)
boukenka and Enderlook
Metadata
Metadata
Assignees
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Componentsarea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-validationIssues related to model validation in minimal and controller-based APIsIssues related to model validation in minimal and controller-based APIs