其他分享
首页 > 其他分享> > Swagger 生成API doc Failed。

Swagger 生成API doc Failed。

作者:互联网

1> HttpVerb and Route Atribute are required to decorate the Action 否则无法生成 api

 

 

namespace FirstWebAPI.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class HomeController : ControllerBase
    {
        [Route("")]
        [HttpPost]
        public IActionResult Index()
        {
            /* method implementation*/
            return Ok();
        }

        [Route("contact")]
        [HttpGet]
        public IActionResult Contact()
        {
            /* method implementation*/
            return Ok("Contact");
        }
    }
}

标签:Ok,IActionResult,api,doc,Route,implementation,API,Swagger,public
来源: https://www.cnblogs.com/running-ahead/p/14798602.html