Swagger 2.0 to OpenAPI 3.x

Swagger 2.0 to OpenAPI 3.x: Replaces host and basePath with OpenAPI 3 `servers: [{ url: 'https://api.example.com/v1' }]` and updates root version.

Swagger To Openapi · Client runtimeSandboxed
Formatted results will render here in real time.

About this swagger 2.0 to openapi 3.x

Replaces host and basePath with OpenAPI 3 `servers: [{ url: 'https://api.example.com/v1' }]` and updates root version Validates and converts interface schemas client-side without transmitting private endpoint specifications.

API contract & interface schema logic

Converts selected Swagger 2.0 JSON or YAML fields into OpenAPI 3.0.3 or 3.1.0: host/basePath/schemes become server URLs, definitions and references move to components, and consumes/produces become request/response content media types.

Worked schema conversion scenario

Scenario: Convert a minimal Swagger 2.0 document's root version, info and host/basePath into OpenAPI 3.0.3 fields.

Sample input:

swagger: '2.0' info: title: Legacy API version: '1.0' host: api.example.com basePath: /v1 schemes: - https paths: {}

Processing: The client-side engine parses the provided input, executes the transformation routine, and outputs the result in real time.

Illustrative output:

openapi: 3.0.3 info: title: Legacy API version: "1.0" paths: {} servers: - url: https://api.example.com/v1

Schema version & syntax constraints

Input must be smaller than 10,000,000 UTF-8 bytes. This selected-field migration does not validate every Swagger extension or guarantee full semantic equivalence; review OAuth2 security definitions and unsupported fields.

API specifications and schema models in Swagger 2.0 to OpenAPI 3.x reflect OpenAPI and JSON Schema standards. Verify generated schemas against your runtime validator.

Client-side schema processing boundary

Schema analysis and protocol mapping in Swagger 2.0 to OpenAPI 3.x execute locally in the browser tab without uploading endpoint definitions.

OpenAPI Specification & JSON Schema standards

OpenAPI Specification standards and JSON Schema draft definitions:

Swagger 2.0 to OpenAPI 3.x verification · Audit standards

How to use it

  1. Paste a Swagger 2.0 JSON or YAML document.
  2. Choose OpenAPI 3.0.3 or 3.1.0.
  3. Convert supported server, schema reference, body/form and media type fields, then copy the JSON or YAML output.

Frequently asked questions

What does Swagger to OpenAPI convert?+

It accepts Swagger 2.0 JSON or YAML and emits OpenAPI 3.0.3 or 3.1.0. It moves host/basePath/schemes to servers, definitions and references to components, and consumes/produces to request/response content media types.

Can you show an input and its result?+

A Swagger 2.0 document with host api.example.com, basePath /v1, HTTPS scheme, /pets GET, and Pet definition produced OpenAPI 3.0.3 with server https://api.example.com/v1, preserved GET path, and components.schemas.Pet.

How are body and form parameters handled?+

A body parameter becomes an application/json requestBody and is removed from operation parameters. FormData parameters become an object requestBody with multipart/form-data when the operation consumes it, otherwise application/x-www-form-urlencoded.

What does this migration not guarantee?+

It does not claim full semantic equivalence across Swagger and OpenAPI dialects, validate every source extension, choose correct media types beyond implemented rules, or prove downstream clients and servers accept the converted document.