OpenAPI / Swagger Spec Validator

Validate an OpenAPI 3.x or Swagger 2.0 YAML or JSON spec in your browser.

Ad placeholder (leaderboard)

An OpenAPI (formerly Swagger) document describes a REST API in a machine-readable way: its endpoints, parameters, request bodies, and responses. Tools generate clients, servers, and docs from it — but only if it is structurally correct. This validator parses your YAML or JSON spec in the browser and checks it against the rules that the most common mistakes violate.

How it works

The tool runs in two stages:

  1. Parse. If the input starts with { or [ it is parsed as JSON. Otherwise a built-in block-style YAML parser converts the document into an object, handling indentation, key: value pairs, lists, and inline scalars.
  2. Validate. It then walks the object and applies the structural rules — version format, the required info.title and info.version, the paths object, and for each operation a responses object keyed by valid status codes or default. Inline parameters must declare name and in, and OpenAPI 3.x parameters are expected to carry a schema.

Every problem is reported with a JSON-pointer-style path such as paths/pets/get/responses, so a long spec is quick to fix.

Example

A response block keyed by an invalid code is caught:

responses:
  "20A":      # invalid — not a status code
    description: Bad

The validator flags paths/.../responses/20A: invalid status code key. A valid spec instead uses "200", "404", or default.

Notes

This is a structural validator, not a full schema validator with external $ref resolution. It catches the errors that break code generators and doc tools — missing responses, malformed versions, parameters without a name — while keeping your spec entirely on your own device.

Ad placeholder (rectangle)