Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
WebAPI .NET 9
Nuget: Microsoft.AspNetCore.OpenApi 9.0.1
Hello, when I use attribute:
[ProducesResponseType<Dictionary<AuthErrorType, ErrorDetail>>(403)]
the enum values are not generated in the OpenApi.json under the components/schemas section.
The enum is not generated even when using minimal API
app.MapGet("/minimal-api-approach", () => { return "Hello World!"; }).Produces<Dictionary<AuthErrorType, ErrorDetail>>();
`public class WeatherForecastController : ControllerBase
{
public WeatherForecastController() {
[HttpGet(Name = "controller-approach")]
[ProducesResponseType<FailureResult<AuthErrorType>>(401)]
[ProducesResponseType<Dictionary<AuthErrorType, ErrorDetail>>(403)]
public Task<IActionResult> Get()
{
throw new NotImplementedException();
}
public record FailureResult<T>(Dictionary<T, ErrorDetail> Errors) where T : Enum;
public record ErrorDetail(string Description);
[JsonConverter(typeof(JsonStringEnumConverter<AuthErrorType>))]
public enum AuthErrorType
{
InvalidCredentials,
InvalidLogin
}}`
Expected Behavior
The expected result is a generated enum values in the components/schemas section.
With NSwag the result is below:
`
"components": {
"schemas": {
"AuthErrorType": {
"type": "integer",
"description": "",
"x-enumNames": [
"InvalidCredentials",
"InvalidLogin"
],
"enum": [
0,
1
]
}
}
}`
Steps To Reproduce
https://github.com/PatrezDev/openapispec-net-nswag
Exceptions (if any)
No response
.NET Version
.NET 9