DevTools Logo

OpenAPI / Swagger Editor

OpenAPI / Swagger Editor

Parse, validate, and preview OpenAPI 3.x or Swagger 2.0 documents

Spec Input

2 spaces

About this tool

This tool parses an OpenAPI (3.x) or Swagger (2.0) document supplied as JSON or YAML, validates that it declares an API version and the required info/paths blocks, and renders a browsable preview: the API title and version, declared servers, every operation (method + path + summary), and a count of reusable schemas. The parsed document is re-emitted as formatted JSON. Use it to sanity-check a spec or explore an API without external tooling. Parsing is client-side; nothing is uploaded.

Examples & Use Cases

Minimal OpenAPI 3.1

openapi: 3.1.0
info:
  title: Pet Store API
  version: 1.0.0
paths:
  /pets:
    get:
      summary: List all pets
    post:
      summary: Create a pet

The smallest valid OpenAPI 3.x document — version, info, and a single path with two operations.

Legacy Swagger 2.0

swagger: "2.0"
info:
  title: Legacy API
  version: 0.9.0
host: api.example.com
basePath: /v1
paths:
  /users:
    get:
      summary: List users

Older Swagger 2.0 specs are detected and parsed the same way.

    Examples

    Parse and preview an OpenAPI 3.1 document

    Input
    {"openapi":"3.1.0","info":{"title":"Pet API","version":"1.0.0"},"servers":[{"url":"https://api.example.com"}],"paths":{"/pets":{"get":{"summary":"List pets"}}}}
    Output
    Title: Pet API
    Servers: https://api.example.com
    Endpoints: GET /pets (1)
    Schemas: 0

    After parsing, the preview shows the API title, the server URL, a count of endpoints with their methods, and the total number of schema definitions.

    Detect a Swagger 2.0 document

    Input
    {"swagger":"2.0","info":{"title":"Legacy API","version":"1.0"},"basePath":"/api","paths":{"/users":{"get":{}}}}
    Output
    Detected: Swagger 2.0
    Title: Legacy API
    Endpoints: GET /users (1)
    Schemas: 0

    The tool detects the swagger: "2.0" key and renders a Swagger 2.0 preview. Note that server/basePath handling differs between the two versions.

    About this tool

    OpenAPI & Swagger Editor parses, validates and previews OpenAPI 3.x and Swagger 2.0 specification documents in JSON or YAML. It uses js-yaml to parse the YAML branch, then renders a summary card showing the API title, server list, method-colour-coded endpoint list, and schema count.

    You can also re-emit the parsed document as pretty-printed JSON (or YAML), so you can paste messy input and get clean, reformatted output to paste back into your editor. A clear error banner shows the specific parse error with a line number when the input is invalid.

    All processing — parsing, validation, preview rendering, and re-emission — happens entirely in your browser. Your API specification never leaves your device.

    How to use this tool

    1. Paste or load an OpenAPI spec

      Paste your OpenAPI 3.x or Swagger 2.0 spec in JSON or YAML, or click Load sample to try a built-in example.

    2. Review the preview card

      The preview shows the API title, server URLs, endpoint count (with HTTP methods colour-coded), and the number of schema definitions.

    3. Re-emit formatted output

      Click Format JSON or Format YAML to serialize the parsed document back out in clean, indented form.

    4. Handle errors

      If the spec is invalid, an error banner appears with the specific message and line number so you can fix the source and try again.

    Use cases

    Validating a spec before committing

    Paste your OpenAPI YAML and confirm it parses without errors before pushing it to the repository, catching syntax mistakes early.

    Quick API documentation review

    Share a spec by pasting it into the editor and pointing a reviewer at the URL — the preview card shows the surface area at a glance.

    Re-formatting a messy YAML spec

    Paste hand-edited or machine-generated YAML that has inconsistent indentation, then re-emit the formatted JSON version to restore clean structure.

    Common mistakes

    Mistake:Mixing OpenAPI and Swagger versions in one document.

    Fix:Use exactly one of openapi: 3.x.x (OpenAPI 3.x) or swagger: 2.0 (Swagger 2.0). The tool detects which is present; having both causes a parse error.

    Mistake:Forgetting that YAML keys with colons need quoting.

    Fix:Values containing : followed by space must be quoted in YAML (e.g. "application/json"), otherwise the parser splits them at the colon and produces an invalid structure.

    Frequently asked questions

    What API specification formats does the editor support?

    It parses OpenAPI 3.x (JSON and YAML) and Swagger 2.0 (JSON and YAML) using js-yaml for the YAML branch. The editor auto-detects the version on load and renders the appropriate preview.

    What does the preview show?

    The preview card shows the API title, a server list, a method-colour-coded endpoint list (colour-coded by HTTP method — GET, POST, PUT, DELETE, etc.), and a schema count. Invalid or unparseable input shows an error banner instead.

    Can I re-emit formatted JSON from a YAML input?

    Yes. After parsing, the tool can serialize the document back out as pretty-printed JSON (or YAML), so you can paste messy YAML and get clean, re-formatted output to paste back into your editor.

    Is my OpenAPI spec uploaded?

    No. Parsing, validation, preview rendering, and re-emission all run in your browser. Your API specification never leaves your device.

    References & standards

    .env Secret Safety Linter

    Validate .env syntax and spot likely leaked credentials or placeholder secrets.

    .htaccess Generator

    Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth

    2D Fluid Dynamics & Particle Physics Sandbox

    A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.

    AI Function Calling Schema Generator

    Generate function calling JSON schemas from TypeScript interfaces

    Algorithm Arena & Data Structure Visualizer

    Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.

    Ansible Playbook Generator

    Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML