Files
simapi-net/Attributes/SimApiDocAttribute.cs
T

29 lines
831 B
C#
Raw Normal View History

2024-03-23 07:29:43 +08:00
using System;
2020-02-18 06:37:48 +08:00
using Swashbuckle.AspNetCore.Annotations;
2019-12-23 16:32:06 +08:00
2024-03-23 07:29:43 +08:00
namespace SimApi.Attributes;
/// <summary>
/// 快捷自定义接口文档类
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
public class SimApiDocAttribute : SwaggerOperationAttribute
2019-12-23 16:32:06 +08:00
{
/// <summary>
2024-03-23 07:29:43 +08:00
/// 定义接口说明
2019-12-23 16:32:06 +08:00
/// </summary>
2024-03-23 07:29:43 +08:00
/// <param name="tag">接口分组</param>
/// <param name="name">接口名称</param>
2026-03-26 00:32:20 +08:00
/// <param name="description">接口描述</param>
public SimApiDocAttribute(string tag, string name, string? description = null)
2019-12-23 16:32:06 +08:00
{
2025-11-01 15:40:55 +08:00
Tags = [tag];
2024-03-23 07:29:43 +08:00
Summary = name;
2026-03-26 00:32:20 +08:00
if (description != null)
{
Description = description;
}
2024-03-23 07:29:43 +08:00
// Consumes = new[] {"application/json"};
// Produces = new[] {"application/json"};
2019-12-23 16:32:06 +08:00
}
}