Skip to content

ValidatatableTypeAttribute does not work on records #62315

Open
@maartenvansambeek

Description

@maartenvansambeek

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When I decorate a record type with a [ValidatatableType] attribute, no validation information is generated for the type.

Expected Behavior

Both classes and records decorated with [ValidatableType] should cause validation information to be created.

Steps To Reproduce

Clone this repository: https://github.com/maartenvansambeek/validatabletype-on-records.git

Run dotnet build using .NET 10 preview 5.

Look at line 64 in the file:
obj\Debug\net10.0\generated\Microsoft.AspNetCore.Http.ValidationsGenerator\Microsoft.AspNetCore.Http.ValidationsGenerator.ValidationsGenerator\ValidatableInfoResolver.g.cs

See that information is generated for the class type, but not the records type in the project.

Exceptions (if any)

No response

.NET Version

10.0.100-preview.5.25277.114

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    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