Using Swashbuckle for Asp.net core how can I add a model to the generated model list?

后端 未结 4 1536
耶瑟儿~
耶瑟儿~ 2021-02-02 15:35

I\'m using Swashbuckle with ASP.net core. It is producing a nice website with a list of models at the bottom.

How can I add a model to this list that isn\'t al

4条回答
  •  情书的邮戳
    2021-02-02 16:18

    Maybe not the cleanest solution but I achieved the same by setting a ProducesResponseType attribute above my Controller:

    [ProducesResponseType(typeof(object), 200)]
    public class FileController : Controller
    {
    

    Where you replace object with the object you want to display in the model and create a new line for each additional one. Just be sure you use a different Statuscode for each one, else it'll only display the last.

提交回复
热议问题