Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating Swagger docs in asp.net mvc 5

I have an application that I'm building an API into. It's a .net 4.6 MVC app. I'm building the API into a controller, but for some reason swagger won't see my controllers.

[AllowAnonymous]
[TokenFilter]
[Route("[controller]/[action]")]
public class TestApiController : Controller
{
    #region GENERAL DATA
    [HttpGet]
    public JsonResult GetTestCompany()
    {

This is how i have my controller laid out. I just a a blank screen that has the UI and says

[ base url: , api version: v1 ]

Nothing else is on the page.

I'm using Swashbuckle

like image 259
TheDizzle Avatar asked Sep 14 '25 07:09

TheDizzle


1 Answers

Swagger doesn't work with mvc controller unfortunately. It only works with ApiController for a Restful API

like image 133
khanh1nt Avatar answered Sep 15 '25 22:09

khanh1nt