NSwag中的自定义架构名称

埃瓦尔达斯(Evaldas Buinauskas)

我已经阅读了许多文档并搜索了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] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章