7

My api is running net core 3.0 with Swashbuckle.AspNetCore 5.0.0-rc5

When I run autorest on my generated swagger.json file I get:

swagger.json is not a valid OpenAPI 2.0 definition (expected 'swagger: 2.0')

My swagger.json file does indeed say "openapi": "3.0.1". It used to be v2.0 but since I upgraded to net core 3.0 I had to upgrade Swashbuckle which now creates the json file with v3.0.1

I ran "choco install autorest" so I should be running the latest version

If autorest doesn't support openapi3.0 there must still surely be a way to generate an openapi2.0 json file?

levis84
  • 974
  • 1
  • 12
  • 27

1 Answers1

7

Followed this thread, auto rest doesn’t support latest open api yet but there are workarounds

https://github.com/Azure/autorest/issues/2680

You can do this:

app.UseSwagger(o => o.SerializeAsV2 = true);
levis84
  • 974
  • 1
  • 12
  • 27
  • 1
    Apparently it does support openapi 3 now https://github.com/Azure/autorest/tree/c0d999efd7498862ba800050bd7bcd7c6b57e91f – Kirsten Mar 23 '20 at 19:55