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:
- 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: valuepairs, lists, and inline scalars. - Validate. It then walks the object and applies the structural rules — version format, the required
info.titleandinfo.version, thepathsobject, and for each operation aresponsesobject keyed by valid status codes ordefault. Inline parameters must declarenameandin, and OpenAPI 3.x parameters are expected to carry aschema.
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.