【发布时间】:2020-12-15 19:07:51
【问题描述】:
我有以下枚举:
public enum TicketQuestionType
{
General = 1,
Billing = 2,
TMS = 3,
HOS = 4,
DeviceManagement = 5
}
和模型类:
public class TicketCreateApi
{
public string Subject { get; set; }
public TicketQuestionType QuestionType { get; set; } = TicketQuestionType.General;
public TicketType Type { get; set; } = TicketType.Problem;
public TicketStatus Status { get; set; } = TicketStatus.New;
public TicketPriority Priority { get; set; } = TicketPriority.Normal;
public string Description { get; set; }
public List<string> Attachments { get; set; }
public int? DeviceId { get; set; }
public int? DriverId { get; set; }
}
我的 API 方法使用它:
Task<IActionResult> Create(TicketCreateApi model);
Swagger 生成以下内容:
还有这个:
所以,我们只能看到默认值,而无法看到可用的枚举列表(名称和值)。 我想展示它。怎么做?
【问题讨论】:
标签: asp.net-core asp.net-web-api swagger swashbuckle swashbuckle.aspnetcore