#290 · Developer Tool

Swagger 2.0 to OpenAPI 3 Converter

Convert the most common Swagger 2.0 structures into an OpenAPI 3.0 JSON document for further editing. The migration moves definitions, parameters, responses, and security definitions into components; builds a server URL from schemes, host, and basePath; converts body parameters into requestBody; turns form data into a content schema; and wraps response schemas in content. Local references are rewritten to their new component locations throughout the document.

Developer Input

OpenAPI JSON
Ad space

How to use this developer tool

  1. Paste a JSON-formatted API document or load the included sample.
  2. Check that the document shape matches the label above the editor.
  3. Select “Convert to OpenAPI 3” or press Ctrl/Cmd + Enter.
  4. Review the summary and download the copy-ready result.

What this developer tool does

The converter performs a practical structural migration while preserving paths, operations, descriptions, extensions, and reusable component names.

Operation consumes and produces override root values. Body parameters become requestBody, while non-body parameters remain in the parameters array.

The result targets OpenAPI 3.0.3 and should be reviewed where Swagger collection formats or file uploads were used.

Example

The Sample button loads a small specification chosen for this operation. Running it produces the same structured fields shown in the output panel.

{
  "swagger": "2.0",
  "info": {
    "title": "Pet API",
    "version": "1"
  },
  "basePath": "/v1",
  "schemes": [
    "https"
  ],
  "host": "api.example.com",
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "definitions": {
    "Pet": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        }
      }
    }
  },
  "paths": {
    "/pets": {
      "post": {
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/Pet"
            }
          }
        ],
        "responses": {
      
…

Use cases

  • Review an API contract during a pull request.
  • Prepare documentation or deterministic test fixtures.
  • Find migration work before changing generators or clients.
  • Export a focused report without sharing the source document.

Tips for reliable output

  • Bundle remote references before running the page.
  • Keep operation IDs stable across published versions.
  • Prefer explicit examples for domain-specific values.
  • Validate the complete document after applying generated output.
  • Commit the original specification before a conversion.

Processing details

The source is deep-cloned, Swagger-only root fields are removed, local reference prefixes are rewritten, and operation request/response payloads are migrated.

Complex formData encoding, OAuth flow translation nuances, file uploads, callbacks, and vendor-specific behavior may require manual adjustments.

Frequently asked questions

Does this page accept YAML OpenAPI files?

No. This browser-only implementation accepts JSON so parsing behavior stays predictable without loading an external YAML library. Convert YAML to JSON first.

Are external $ref URLs resolved?

No. Local JSON Pointer references are handled where the operation needs them, but remote references are not fetched.

Does the result replace a full OpenAPI validator?

No. Swagger 2.0 to OpenAPI 3 Converter performs its documented transformation or audit. Use a standards-aware validator before publishing a specification.

Is the specification uploaded to a server?

No. Processing runs in the current browser tab. The page does not send the pasted document to an API.

Can I download the result?

Yes. Run the tool, then use Download for the primary output or the JSON and CSV buttons when those structured exports are available.

Input contract

ItemRequirement
FormatJSON object
ExecutionLocal browser
Remote refsNot fetched

API & GraphQL Tools

Browse contract inspection, conversion, request, response, and schema utilities.

Open category hub