Skip to main content

OpenAPI v2 to v3 Converter

Convert a Swagger 2.0 (OpenAPI v2) spec into OpenAPI 3.x — host/basePath/schemes become servers, definitions become components.schemas with every $ref rewritten, body/formData parameters become requestBody, and produces/consumes become per-response/per-request content maps. Accepts and emits YAML or JSON, and runs entirely in your browser.

Input

Options

Output

Summary

Result
MetricValue
No data yet

Issues

Result
SeverityPathMessage
No data yet
OpenAPI 3.0.3 Spec
 
Was this helpful?

Guides

The OpenAPI v2 to v3 Converter turns a Swagger 2.0 spec into OpenAPI 3.0.3 — the format most modern tooling (Swagger UI, Redoc, code generators, API gateways) now expects. Paste your spec as YAML or JSON and get back a converted document, a summary of what changed, and a list of anything that needed attention.

What it converts

  • host + basePath + schemesservers[]. host: api.example.com, basePath: /v1, schemes: [https] becomes servers: [{ url: "https://api.example.com/v1" }], one entry per scheme.
  • definitionscomponents.schemas. Every schema keyword is carried over, including Swagger-only ones: x-nullable becomes nullable, and a type: file schema becomes { type: string, format: binary }.
  • Every $ref is rewritten, anywhere in the document — not just at the top level. #/definitions/Pet becomes #/components/schemas/Pet, and the same applies to #/parameters/ and #/responses/ refs, however deeply nested inside array items, allOf, or response schemas.
  • Body and form parameters → requestBody. A parameter with in: body becomes requestBody.content[mime].schema, keyed by the operation's consumes list. formData parameters are collapsed into a single object schema, using multipart/form-data automatically when a type: file field is present.
  • produces/consumes → per-response and per-request content maps, one entry per declared MIME type.
  • securityDefinitionscomponents.securitySchemes. basic becomes { type: http, scheme: basic }; apiKey carries over as-is; oauth2 maps Swagger's four flow names (implicit, password, application, accessCode) onto OpenAPI 3's flows object (applicationclientCredentials, accessCodeauthorizationCode).
  • collectionFormatstyle/explode on array parameters (csv → form style, multi → exploded form, ssv/pipes → space/pipe-delimited).

Patch mode

Turn on Patch missing required fields to have the tool fill gaps that OpenAPI 3 requires but Swagger 2.0 didn't always enforce — a missing info.title, info.version, or response description gets a placeholder value, logged as an informational note. Turn it off to see the same gaps reported as errors instead, with the conversion still completed best-effort.

What's intentionally left alone

An unrecognized securityDefinitions type is copied through unchanged rather than guessed at. A body or form parameter inside Swagger's top-level reusable parameters map is skipped with a warning, since OpenAPI 3 doesn't allow a body to be a reusable parameter — it needs to move into each operation's requestBody by hand. Schema-level discriminator and xml keywords pass through as-is, since their exact shape is highly spec-specific.

Output format

Choose Same as Input, YAML, or JSON for the output — the tool detects whether you pasted YAML or JSON automatically, so you can convert between the two at the same time as converting the spec version.

Is my spec uploaded anywhere?

No — parsing and conversion run entirely in your browser. Nothing is sent to a server.

openapiswaggerapiconverteryamljsonrest

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.