using System; using Swashbuckle.AspNetCore.Annotations; namespace SimApi.Attributes; /// /// 快捷自定义接口文档类 /// [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)] public class SimApiDocAttribute : SwaggerOperationAttribute { /// /// 定义接口说明 /// /// 接口分组列表 /// 接口名称 /// 接口描述 public SimApiDocAttribute(string[] tags, string name, string? description = null) { Tags = tags; Summary = name; if (description != null) { Description = description; } // Consumes = new[] {"application/json"}; // Produces = new[] {"application/json"}; } /// /// 定义接口说明 /// /// 接口分组 /// 接口名称 /// 接口描述 public SimApiDocAttribute(string tag, string name, string? description = null) : this([tag], name, description) { } }