Fixed open api enum schema filter not setting type

By not setting the type and format, it would remain integer is this case, which would result in an invalid specification as the enum members are strings.
This commit is contained in:
Vitor Rodrigues
2023-08-26 17:49:22 +02:00
committed by Emma L Garland
parent e17fa957d6
commit 5c514ca6c6

View File

@@ -12,6 +12,8 @@ public class EnumSchemaFilter : ISchemaFilter
{
if (context.Type.IsEnum)
{
model.Type = "string";
model.Format = null;
model.Enum.Clear();
foreach (var name in Enum.GetNames(context.Type))
{