using Microsoft.OpenApi.Any;
|
using Microsoft.OpenApi.Models;
|
using Swashbuckle.AspNetCore.SwaggerGen;
|
using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Linq;
|
using System.Reflection;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace FlexJobApi.Core
|
{
|
public class EnumSchemaFilter : ISchemaFilter
|
{
|
public void Apply(OpenApiSchema schema, SchemaFilterContext context)
|
{
|
if (context.Type.IsEnum)
|
{
|
// 枚举类型的描述(来自枚举本身的注释)
|
schema.Description = EnumUtils.GetModel(context.Type).Result.ToJson();
|
}
|
}
|
}
|
}
|