我已经阅读了许多文档并搜索了Internet,但是我找不到如何使用NSwag执行以下操作:
services.AddSwaggerGen(c =>
{
c.CustomSchemaIds(type => type.FullName);
};
这取自Swashbuckle,我正在寻找NSwag中的等效项。
我想要这个是因为我有嵌套的DTO类,这些类带有编号后缀,我希望能够通过父类+实际的DTO而不是编号后缀来区分这些DTO:
using System.Collections.Generic;
namespace Blog.Api.Responses
{
public class IndustriesResponse : List<IndustriesResponse.IndustryDto>
{
public class IndustryDto
{
public string Code { get; set; }
public bool IsEditable { get; set; }
}
}
}
using System.Collections.Generic;
namespace Blog.Api.Requests
{
public class UpdateIndustriesRequest : List<UpdateIndustriesRequest.IndustryDto>
{
public class IndustryDto
{
public string Code { get; set; }
public bool IsEditable { get; set; }
}
}
}
实现自己的ISchemaNameGenerator并将其与SchemaNameGenerator设置属性一起使用
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句