Skip to content

Provide a way to customize the default validation message #61534

Open
@marcominerva

Description

@marcominerva

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When we get a validation error in .NET 10 Preview 3, we obtain something like this:

{
  "title": "One or more validation errors occurred.",
  "errors": {
    "Id": [
      "The field Id must be between 1 and 10."
    ]
  }
}

If a multi-language service, we can easily customize the error message for each property using resource files. However, currently we don't have a way to change the title property (One or more validation errors occurred.).

Expected Behavior

We should be able to change the value of the title property, for example to support multi-language scenarios.

.NET Version

10.0.100-preview.3.25201.16

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesfeature-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