OpenAPI validator

Runs in your browser; nothing is uploaded

Check an OpenAPI 3.0 or 3.1 or a Swagger 2.0 spec, in JSON or YAML, for the mistakes that break tools: missing fields, path parameters, response codes, duplicate operationIds, broken $refs and examples that don't match their schema. Nothing is uploaded.

Spec

Problems

Nothing yet

Paste a spec on the left, or pick an example. It's checked as you type.
Ready
Ln 1, Col 1

What the OpenAPI validator checks

An OpenAPI document describes an HTTP API: its paths, the operations on each, their parameters, request bodies and responses. Documentation sites, code generators, mock servers and test tools all read it, and each reacts differently to a mistake. One renders a blank page, another generates code that doesn't compile, a third silently skips the endpoint. Validating first saves the guesswork.

This validator checks the rules of OpenAPI 3.0, 3.1 and Swagger 2.0 that cause trouble in practice. Required fields must be there: openapi, info.title, info.version, paths, a description on every response. Every {param} in a path needs a matching path parameter with required: true. Status codes must be real, operationIds unique, and parameters not declared twice. Every $ref must point to something, security requirements must name a defined scheme, and examples must match their schemas.

Each problem shows the JSON pointer of where it is, such as /paths/~1pets~1{petId}/get, and for JSON input the line number. Errors break the spec for most tools; warnings are things that work but are usually unintended, such as a schema nothing uses.

How to use this tool

  1. 1Paste a spec, JSON or YAML, or pick an example.
  2. 2Read the problems on the right: errors first, then warnings, each with where it is.
  3. 3Fix them in the editor; the list updates as you type.
  4. 4When it's clean, open it in the API Map to see it as a map, or convert it to Postman or cURL.

Troubleshooting

info.version must be a string
YAML reads version: 1.0 as the number 1. Quote it: version: '1.0'.
"200" isn't a status code
In YAML, write response codes in quotes, '200':, so they're read as strings.
doesn't declare a path parameter
Every {name} in a path needs a parameter with in: path, the same name, and required: true, at the path or the operation level.

Frequently asked questions

Is my spec uploaded?

No. It's parsed and checked in your browser, so internal APIs are safe to paste.

Does it follow $refs to other files?

No. References to other files or URLs are listed as a warning, so you know that part wasn't checked.

Can I generate tests from my spec?

Yes: API tests on testingapis.com generate tests from an OpenAPI spec and run them against your API on a schedule.