maliming 3 years ago
parent
commit
fca8c61648
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 14
      framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleEnumSchemaFilter.cs

14
framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleEnumSchemaFilter.cs

@ -2,7 +2,6 @@
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen; using Swashbuckle.AspNetCore.SwaggerGen;
using System; using System;
using System.Linq;
namespace Volo.Abp.Swashbuckle; namespace Volo.Abp.Swashbuckle;
@ -13,11 +12,12 @@ public class AbpSwashbuckleEnumSchemaFilter : ISchemaFilter
if (context.Type.IsEnum) if (context.Type.IsEnum)
{ {
schema.Enum.Clear(); schema.Enum.Clear();
schema.Type = nameof(String); schema.Type = "string";
schema.Format = nameof(String); schema.Format = null;
Enum.GetNames(context.Type) foreach (var name in Enum.GetNames(context.Type))
.ToList() {
.ForEach(name => schema.Enum.Add(new OpenApiString($"{name}"))); schema.Enum.Add(new OpenApiString($"{name}"));
}
} }
} }
} }

Loading…
Cancel
Save