aspnetcore
aspnetcore copied to clipboard
Microsoft.Extensions.ApiDescription.Server - Nullable query parameters are not generated as nullable in OpenAPI Document
cc: @captainsafia Nullable query parameters are not generated as nullable in OpenAPI Document, such as:
group.MapGet("long", (long? myLong) => { })
.WithName("NullableLong");
becomes:
"get": {
"tags": [
"Nullable"
],
"operationId": "NullableLong",
"parameters": [
{
"name": "myLong",
"in": "query",
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
I believe the cause is line 745: https://github.com/dotnet/aspnetcore/blob/684e739228ae335a81e0dc7154e5c362f478cfc8/src/OpenApi/src/Services/OpenApiDocumentService.cs#L739-L761
Is there a historical reason for always unwrapping nullable parameter types?