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.
Swagger Editor has a Convert to OpenAPI 3 option under the Edit drop-down that acts as an interface to this API. All we need to do is open our document in Swagger Editor, then convert by using Edit > Convert to OpenAPI 3. This will replace our document with the OAS 3.0 version. It worked!
It contains a variety of changes, and even though everything that can be expressed in Version 2 is supported in Version 3 as well, specifications are not backwards-compatible.
OpenAPI 3.0 is the latest version of the specification. The Swagger tools, which are supported by SmartBear Software, are among the most popular tools for implementing the OpenAPI Specification, and will continue to maintain the Swagger name (Swagger Editor, Swagger UI, SwaggerHub, etc.)
LucyBot api-spec-converter (online version, GitHub repo, Node.js module) can convert from OpenAPI 3.0 to 2.0.
API Transformer also claims to be able to convert OpenAPI 3.0 back to OpenAPI 2.0. There's a command-line version too.
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).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With