Skip to content

Update Minimal API validation logic for backwards compatibility #62584

Open
@danroth27

Description

@danroth27

Currently, the new minimal API validation support will run object level validation even if there are property level validation failures. This is different from the Validator behavior in System.ComponentModel.DataAnnotations, which will stop if there are any property level validation errors. The assumption is that object level validation may rely on the properties already being valid. The new validation behavior is a breaking change for Blazor apps that opt into the new validation support. We should consider aligning with the original System.ComponentModel.DataAnnotations behavior.


Update the ValidatableTypeInfo implementation in Microsoft.Extensions.Validation to validate properties on a type before running validations on IValidtableObject or subtypes of the type.

Update existing tests to react to this change.

Make modifications only in the src/Validation directory in the repo.

Metadata

Metadata

Assignees

Labels

area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-validationIssues related to model validation in minimal and controller-based APIs

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions