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?
Asked
Active
Viewed 22 times
0
-
You could check this related document:https://learn.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetcore-6.0&tabs=visual-studio – Ruikai Feng Jun 28 '23 at 02:21
-
Thanks Feng. That's informative. Why am I getting two swagger.json files? One for swagger UI and another for "api" ? Why the content on my "api" swagger.json i mostly empty ? Any pointer ? – user1748546 Jun 28 '23 at 06:13
-
could you show your codes related swagger in your program.cs? – Ruikai Feng Jun 28 '23 at 09:21