AsyncCrudAppService使用TCreateInput和TUpdateInput时会破坏Swagger的问题。
创始人
2024-09-21 02:30:30
0

我们可以使用Swagger的描述符手动添加这些类型,并在服务上注释它们。以下是一个示例:

public class MyCreateInputDto
{
    // Add a Swagger description for this type
    [SwaggerSchema(Description = "Input type for creating a new entity")]
    public string Name { get; set; }
}

public class MyUpdateInputDto
{
    // Add a Swagger description for this type
    [SwaggerSchema(Description = "Input type for updating an existing entity")]
    public int Id { get; set; }

    // Add a Swagger description for this property
    [SwaggerSchema(Description = "New name for the entity")]
    public string Name { get; set; }
}

public interface IMyAppServiceAsync : IAsyncCrudAppService
{
    // Add a Swagger description for this method
    [SwaggerOperation(Summary = "Creates a new entity", OperationId = "MyAppService.Create")]
    Task Create([FromBody] MyCreateInputDto input);

    // Add a Swagger description for this method
    [SwaggerOperation(Summary = "Updates an existing entity by ID", OperationId = "MyAppService.Update")]
    Task Update(int id, [FromBody] MyUpdateInputDto input);
}

在代码中添加这些描述符后,Swagger将正确显示这些类型并提供有关如何填充它们的信息。

相关内容

热门资讯

终于知道!潮友会插件(透视)h... 终于知道!潮友会插件(透视)hhpoker德州牛仔视频(揭秘攻略有挂助手);无需打开直接搜索打开薇:...
重大通报!上饶中至插件下载(透... 重大通报!上饶中至插件下载(透视)拱趴大菠萝有什么挂(可靠教程有挂方略);亲,拱趴大菠萝有什么挂这款...
重大发现!下载微乐小程序自建房... 重大发现!下载微乐小程序自建房透视(透视)大菠萝免费辅助器(新2026版有人有挂);无需打开直接搜索...
关于!新道游智能辅助器(透视)... 关于!新道游智能辅助器(透视)wepoker有没有挂(揭秘教程有挂实锤);打开点击测试直接进入微信(...
透视插件!皮皮衡阳辅助(透视)... >>您好:hhpoker俱乐部是干嘛的确实是有挂的,很多玩家在这款hhpoker俱乐部是干嘛的游戏中...
一分钟揭秘!潮汕掌上娱辅助器小... 一分钟揭秘!潮汕掌上娱辅助器小说(透视)拱趴游戏破解器(新版2026教程有挂分析)1、下载安装好潮汕...
分享认知!兴动互娱辅助脚本(透... 分享认知!兴动互娱辅助脚本(透视)hhpoker怎么开透视(新2026版新版有挂);无需打开直接搜索...
分享实测!老友辅助工具(透视)... 分享实测!老友辅助工具(透视)we-poker靠谱吗(软件教程真实有挂)您好:老友辅助工具这款游戏可...
盘点一款!宝宝浙江游戏万能辅助... 盘点一款!宝宝浙江游戏万能辅助器(透视)pokemmo手机版透视脚本(2026新版教程有挂秘诀);打...
透视美元局!长城互娱辅助(透视... 较多好评“微乐万能挂官网”开挂(透视)辅助教程 了解更多开挂安装加(136704302)微信号是一款...