76

Is there a generator to convert OpenAPI 3.0 to Swagger 2.0?

Mashery, an API gateway, requires Swagger 2.0 format on input to open endpoint.

1

3 Answers 3

91

Keep in mind that OAS3→OAS2 convertion is lossy in general, because OAS3 has features that did not exist in OAS2 (such as multiple servers, oneOf/anyOf, different schemas per media type, objects in query string parameters, cookie parameters, and others).

1
5

I needed version 2.0 for Power Automate.

When you are building some Azure Functions, try to create them in Visual Studio and enable any checkbox that is named Swagger not OpenAPI.

Now the API of your Azure Function contains the swagger.json that you can set into Power Automate Custom Connector.

1
  • Unsure this should not have been a comment, but this is good context
    – MrMesees
    Sep 20, 2022 at 22:58
0

There is also an abandoned GitHub project https://github.com/kongchen/swagger-maven-plugin that is quite useful. We forked this project and adapted it to our needs (we have to use Google Endpoints which requires OAS 2.0)!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.