Search code examples
c#dockerswaggeropenapiswashbuckle

Where can I find the file swagger.json on my PC, referred to as "localhost"?


I'm developping a C# application, based on Swagger GUI.

When launching the application, my web browser goes to http://localhost:5128/index.html.

On that "web page", there is a reference to a "swagger.json" file, located in "/swagger/v1/swagger.json", which corresponds with this line of source code:

application.UseSwaggerUI(c =>
{
    c.SwaggerEndpoint("/swagger/v1/swagger.json", "Employee API V1");
    ...

However, both windows search and WSL search (find /mnt/c/ -type f 2>/dev/null | grep -i "swagger.json") can't show me where to find that file.

I'm sure the file exists, because when I click on the URL, I get something like this:

enter image description here

Does anybody know where I can find the "swagger.json" file on my PC?

For your information: also the aforementioned directory "swagger" is not found on my PC.


Solution

  • My understanding is that the .json file is not a physical file. When Swagger starts it generates the json file and all associated web content based on the scan of your application controllers. Therefore the swagger.json file is not on disk which is why you can't find it.