-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to generate json for controllers that inherit base controllers #511
Comments
Since I still didn't find a solution, I attached a project sample that reproduces the bug. |
I solved the problem. There were more issues that I only found after appending my solution to Swashbuckle.AspNetCore.
I solved this with the following setting in Startup.cs: services.ConfigureSwaggerGen(options => With this workaround, I also resolved this exception; "HTTP method "GET" & path "Actor" overloaded by actions - I will close the issue. |
I have two controllers that inherit other controllers - for one of them, the swagger doc is generated, for the other it is not.
My controllers are:
Below, BaseDefController, BaseDefControllerLog and LoggerController:
VERSION:
Swashbuckle.AspNetCore 1.0.0
STEPS TO REPRODUCE:
I have decorated both ActorController and ActorCatalogController with the Route attribute. At this point, swagger throws an exception when generating the json. If I remove the route on ActorController and therefore generate documentation only for ActorCatalogController, everything works fine. If I decorate the inherited controllers' actions with route attributes, I also get a 500 response on json. I also tried to remove the virtual keyword, with no luck.
EXPECTED RESULT:
Documentation for both controllers (ActorCatalogController and ActorController).
ACTUAL RESULT:
500 : http://localhost:4100/swagger/v1/swagger.json
The JSON cannot be generated. I catch this exception: "Exception thrown: 'System.NotSupportedException' in Swashbuckle.AspNetCore.SwaggerGen.dll".
ADDITIONAL DETAILS
The target framework for my project is .NET framework 4.6.2. I use Microsoft.AspNetCore 1.1.2 and Microsoft.AspNetCore.Hosting.WindowsServices 1.1.2.
My swagger configuration in Startup.cs is the following:
The text was updated successfully, but these errors were encountered: