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

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

如下:

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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章