swagger.json different for "api-docs/v1.0/swagger.json" and "api/swagger/v1/swagger.json" .Net 6.0 API

34 Views Asked by At

I am using .Net 6.0 with Open API Swagger packages. When I run my application, I find that "api-docs/v1.0/swagger.json" is just fine (However, I would like to tweak title, description etc.). At the same time, "api/swagger/v1/swagger.json" is almost empty. [1] How can I make sure that content of both the files are same ? [2]Is it possible to use a single "swagger.json" file, saved in some physical location ( say - in "bin" folder) to be used for both the purpose? How can I configure that ? [3] In an attempt to make the content same, I tried using "SwaggerDoc()" method "SwaggerGenOptions". Using "OpenApiInfo", I could add "info" properties in "api" version of "swagger.json". The biggest challenge is to add "paths" and "components" section in the json file. How can I add those sections programmatically?

0

There are 0 best solutions below