Fetch error–undefined swagger/v1/swagger.json

I started using https://github.com/RSuter/NSwag which is great, but just be careful when following the instructions on https://github.com/RSuter/NSwag/wiki/AspNetCore-Middleware as you only really need to use one of

services
              .AddOpenApiDocument()
              .AddSwaggerDocument();        

Admittedly the instructions tell you how to setup multiple documents

app.AddOpenApiDocument(document => document.DocumentName = “a”); app.AddSwaggerDocument(document => document.DocumentName = “b”);

but I made the mistake of assuming I needed one of each. I’ve ended up with just

services
              //.AddOpenApiDocument()
              .AddSwaggerDocument();        

Advertisement