-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Closed
Labels
area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templates
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
While playing around moving the applying of validation attributes to a transformer I found this curious part:
else if (attribute is UrlAttribute)
{
schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString();
schema[OpenApiSchemaKeywords.FormatKeyword] = "uri";
}
This forces the type to be "string" always.
The UrlAttribute only works on strings so it would never be the wrong type, so it doesn't need to be "forced" to a string.
Commenting this line still passes all the tests and emits the correct openapi, both for nullable and not nullable strings.
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
.NET 10 RC1
Anything else?
It's a one line change and some tests which can be added to OpenApiSchemaService.PropertySchemas.cs
.
I can pick this up this week.
Metadata
Metadata
Assignees
Labels
area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templates