net core6通过ProducesResponseType特性定义swwaager的输出类型

很多时候控制返回值无法让前端看到对象的属性,可以通过ProducesResponseType来定义。

如下:

        /// <summary>
        /// 获取配置
        /// </summary>
        [HttpGet]
        [ProducesResponseType(typeof(ConfigDto),200)]
        public TipsInfo GetConfig()
        {
            return _configBLL.GetConfig();
        }

 

posted @ 2023-07-18 11:09  鹅是码农  阅读(13)  评论(0编辑  收藏  举报