Lost
Lost

Reputation: 13645

SwashBuckle upgrade does not enable OAS3.0

We are making an upgrade of our webapi to enable OAS3.0 in our dotnet Core application and from the documentation it seems that it is only supported in SwashBuckle.Aspnetcore 5.4.1 + versions. As mentioned here : https://github.com/domaindrivendev/Swashbuckle.AspNetCore

So we upgraded our SwashBuckle.Aspenetcore to 5.4.1. When we ran the applicaiton though, it still does produce swagger 2.0 instead of OAS 3.01. Now, the documentation on the same page does not specify anything special that we have todo when you upgrade from swagger2.0-->OAS3.0 Currently my little configuration looks like below:

app.UseSwaggerUI(c =>
            {                    
                c.SwaggerEndpoint("/myapp/swagger/v1/swagger.json", "API name");
                c.RoutePrefix = "myapp/swagger";
                c.DisplayRequestDuration();
                c.DisplayOperationId();                                
            });

The documentation on the page also point to a page mentioning the support for OAS3.0 in a link here: https://swagger.io/specification/

But again not code to reference to. Can someone point me to specifics of how to upgrade my API from swagger 2.0 to OAS 3.0?

Upvotes: 0

Views: 920

Answers (1)

Helen
Helen

Reputation: 97867

It looks like you have c.SerializeAsV2 = true somewhere in the code. To output OpenAPI 3.0, this option must be false.

Upvotes: 2

Related Questions