OpenAPI Validator
Paste an OpenAPI or Swagger specification as JSON or YAML and validate it instantly in your browser. Review every schema error with its location, plus a summary of paths, operations, and components.
What Is an OpenAPI Validator?
An OpenAPI validator checks a specification document against the rules of the OpenAPI Specification. OpenAPI, formerly called Swagger, is the standard way to describe a REST API in a machine readable file: every endpoint, the parameters each one accepts, the request and response bodies, the data schemas, and the security requirements. This validator parses your JSON or YAML document, resolves every $ref pointer, and reports structural problems such as missing required fields, invalid data types, and references that point nowhere. Everything runs in your browser, so internal API designs never leave your machine.
Supported Versions
The validator accepts OpenAPI 3.0, OpenAPI 3.1, and the older Swagger 2.0 format. It detects the version from the openapi or swagger root field and validates against the matching official JSON Schema. OpenAPI 3.1 aligns fully with JSON Schema, while 3.0 uses a slightly modified dialect, and the validator applies the correct rules automatically in each case.
What Gets Checked
- Required root fields: the version declaration and the
infoobject with its title and version must be present. - Path and operation structure: every entry under
pathsmust be a valid path item, and every operation must declare at least one response. - Schema correctness: data types, required property lists, enums, formats, and numeric bounds are validated against the official schema definitions.
- Reference resolution: every local
$refusing#/components/...or#/definitions/...must resolve to a real node in the document. - Parameter rules: path parameters must be declared as required, and parameter locations must be one of path, query, header, or cookie.
How to Use the Validator
- Paste your specification into the editor. Both JSON and YAML are accepted, and the sample button loads a complete example to try.
- Validation runs automatically as you edit, so there is no button to press. Results appear within a moment of typing.
- Read the status card. A green result confirms the document is valid and shows the detected specification version.
- When something is wrong, each problem appears in the list below with the failing field path in parentheses, such as
(at /paths/~1beans/get/responses). - When the document is valid, review the summary of paths, operations, and schemas to get a quick sense of the API surface.
Why Validate Before You Generate
OpenAPI documents feed a whole ecosystem: code generators that produce server stubs and client SDKs, documentation renderers like Swagger UI and Redoc, gateway configuration, and contract testing tools. A single typo in a $ref path or a missing response schema can break all of them downstream. Validating first catches those errors at the source, when they are a one line fix, instead of during code generation or, worse, at runtime in a gateway configuration. Treating validation as a required step in CI keeps the specification trustworthy as a source of truth.
Common Validation Errors and Fixes
- Missing info: add an
infoobject with at leasttitleandversionfields. - Unresolvable $ref: check the pointer path for typos, and confirm the target node exists under
componentsordefinitions. - Path parameter not required: any parameter declared with
in: pathmust also setrequired: true. - Invalid type value: schema types must use JSON Schema names such as string, number, integer, boolean, array, and object.
- Empty responses: every operation needs at least one response entry, even if it is only a default error response.
Frequently Asked Questions
Frequently Asked Questions
Is my API specification uploaded to a server?
No. Parsing, reference resolution, and schema validation all run inside your browser using a bundled version of the swagger-parser library. The document never leaves your device, which matters when specs describe internal or unreleased APIs.
Does the validator resolve external file or URL references?
The validator works on a single self contained document. Internal references of the form #/components/... are resolved and checked. External references that point to other files or remote URLs are not fetched, so inline those referenced pieces when validating a split specification.
What is the difference between a valid and a well formed document?
A well formed document parses as JSON or YAML. A valid OpenAPI document additionally satisfies the specification schema: required fields present, correct data types, resolvable references, and structurally sound paths and operations. This tool checks both levels.
Can I validate a Swagger 2.0 document?
Yes. Documents that declare swagger: "2.0" are validated against the Swagger 2.0 schema, including the classic definitions section and the parameter and response conventions of that version.
Why does my document show as invalid when another tool accepts it?
Some tools are lenient about missing or malformed fields. This validator applies the official schemas strictly, so a document that code generators happen to tolerate can still fail. Fixing the reported items makes the specification portable across the whole tooling ecosystem.
How many errors are shown at once?
All distinct validation messages are collected, deduplicated, and listed up to a maximum of 50 entries. Fixing the first few usually clears the rest, since a single missing field can cascade into many follow up errors.
Related Tools
Convert a plain schema into a specification with the JSON Schema to OpenAPI Schema converter, tidy the JSON body with the JSON Formatter, validate individual payloads against a schema with the JSON Schema Validator, or draft realistic responses with the Mock API Response Generator.