maliming
2 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
1 changed files with
7 additions and
7 deletions
-
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}")); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|