From fca8c616483ce4fec7cd18ee0147be13b03d422c Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 19 Dec 2023 13:39:52 +0800 Subject: [PATCH] Use `string` as schema type. https://swagger.io/docs/specification/data-models/data-types/#string --- .../Swashbuckle/AbpSwashbuckleEnumSchemaFilter.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleEnumSchemaFilter.cs b/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleEnumSchemaFilter.cs index f637fb005e..b6a20d2ad2 100644 --- a/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleEnumSchemaFilter.cs +++ b/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleEnumSchemaFilter.cs @@ -2,7 +2,6 @@ using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; using System; -using System.Linq; namespace Volo.Abp.Swashbuckle; @@ -13,11 +12,12 @@ public class AbpSwashbuckleEnumSchemaFilter : ISchemaFilter if (context.Type.IsEnum) { schema.Enum.Clear(); - schema.Type = nameof(String); - schema.Format = nameof(String); - Enum.GetNames(context.Type) - .ToList() - .ForEach(name => schema.Enum.Add(new OpenApiString($"{name}"))); + schema.Type = "string"; + schema.Format = null; + foreach (var name in Enum.GetNames(context.Type)) + { + schema.Enum.Add(new OpenApiString($"{name}")); + } } } -} \ No newline at end of file +}