Closed ketovdk closed 4 years ago
Hi, @ketovdk
Using AddEnumsWithValuesFixFilters
becomes useless if you use JsonStringEnumConverter
.
But I agree that the error must be fixed.
It can display the following (after fix):
for:
/// <summary>
/// Tag for TodoItem.
/// </summary>
[Description("Tag enum")]
public enum Tag
{
/// <summary>
/// None.
/// </summary>
[Description("Default tag")]
None = 0,
/// <summary>
/// Task.
/// </summary>
[Description("Some task")]
Task = 1,
/// <summary>
/// Workout.
/// </summary>
[Description("Periodical job")]
Workout = 2
}
AddEnumValuesDescription with System.InvalidCastException: Unable to cast object of type 'Microsoft.OpenApi.Any.OpenApiString' to type 'Microsoft.OpenApi.Any.OpenApiInteger'.
To reproduce: Use json enumToStringMapping with
.AddJsonOptions( options => options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()))
Useoptions.AddEnumsWithValuesFixFilters(true);
in AddSwaggerGen