Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing Swagger UI for API in a different project (Swashbuckle)

We have a .NET solution with 2 projects:

  • ASP.NET MVC Portal project
  • OWIN Host API project (with custom controller selector)

We are trying to expose a public documentation to a few API controllers in the OWIN-based API project We would like to show the Swagger UI from the Portal project for controllers in the API project

So far, all attempts have not been successful. When adding Swagger UI to the Portal project, it only wants to show documentation about controllers in the Portal project, not from the API project.

When adding Swagger UI to the API project (not preferred solution), it doesn't work at all, probably because of the custom controller selector

However, I think I'm missing something obvious as this feels like a very basic configuration setting that we're missing

like image 688
Igorek Avatar asked Oct 30 '22 05:10

Igorek


1 Answers

Swagger UI is only a set a static file rendering OpenAPI (fka. Swagger) Specification files. These specification files can be produced by an application or simply manually written.

You could modify the original Swagger UI to create your own version and replace the URL field (on top near the Authorize button) by a drop list pointing to your 2 different applications producing OpenAPI (fka. Swagger) specification.

like image 77
Arnaud Lauret Avatar answered Nov 18 '22 15:11

Arnaud Lauret