diff --git a/src/Unchase.Swashbuckle.AspNetCore.Extensions/Filters/XEnumNamesSchemaFilter.cs b/src/Unchase.Swashbuckle.AspNetCore.Extensions/Filters/XEnumNamesSchemaFilter.cs index 577e394..b309349 100644 --- a/src/Unchase.Swashbuckle.AspNetCore.Extensions/Filters/XEnumNamesSchemaFilter.cs +++ b/src/Unchase.Swashbuckle.AspNetCore.Extensions/Filters/XEnumNamesSchemaFilter.cs @@ -59,9 +59,11 @@ public void Apply(OpenApiSchema schema, SchemaFilterContext context) schema.Extensions.Add("x-enumDescriptions", enumsDescriptionsArray); } } + return; } + // add "x-enumNames" for schema with generic types - else if (typeInfo.IsGenericType && !schema.Extensions.ContainsKey("x-enumNames")) + if (typeInfo.IsGenericType && !schema.Extensions.ContainsKey("x-enumNames")) { foreach (var genericArgumentType in typeInfo.GetGenericArguments()) { @@ -98,7 +100,8 @@ public void Apply(OpenApiSchema schema, SchemaFilterContext context) } } } - else if (schema.Properties?.Count > 0) + + if (schema.Properties?.Count > 0) { foreach (var schemaProperty in schema.Properties) {