How to use the OpenAPI / Swagger Validator
- Paste your
openapi.yaml/swagger.jsonor open the file. - The version (OpenAPI 3.1, 3.0 or Swagger 2.0) is detected automatically.
- Fix schema errors first — each shows its location in the document.
- Review the additional checks and the endpoint list.
What gets checked
| Check | Details |
|---|---|
| Official schema | The document is validated against the OpenAPI Initiative’s JSON Schema for its version (3.1, 3.0 or Swagger 2.0): required fields, allowed keys, value types |
Broken $ref | Every local reference (#/components/schemas/Pet) must point to something that exists |
Unique operationId | Duplicates break SDK generators and documentation links |
| Path parameters | Every {param} in a path must be declared with in: path and required: true, and vice versa |
| Responses | Each operation needs at least one response |
| Hints | Missing operationId, servers or info.description |
OpenAPI versions
- Swagger 2.0 —
swagger: "2.0",definitions,host/basePath. - OpenAPI 3.0 —
components,servers,requestBody; schemas are a JSON Schema draft-04 subset withnullable. - OpenAPI 3.1 — fully aligned with JSON Schema 2020-12 (
type: [string, "null"]instead ofnullable), addswebhooks.
Limits
External references to other files or URLs are not fetched — bundle multi-file specs first (for example with redocly bundle). Schema validation reports structural problems; style rules such as naming conventions need a linter like Spectral. Validate example payloads against your schemas with the JSON Schema validator, check YAML syntax with the YAML validator, and try the live API with the API tester.
Tools that pair well with the OpenAPI / Swagger Validator
- JSON Formatter — Paste JSON to pretty-print, minify or validate it.
- cURL to Code — Paste a curl command — from API docs or “Copy as cURL” in your browser’s DevTools — and get ready-to-run code for six languages, with headers, body and authentication carried over.
- JSONPath Tester — Type a JSONPath query and instantly see what it selects — with the exact path of each match.
- JSON to YAML — Paste JSON and get clean YAML for Kubernetes manifests, Docker Compose, GitHub Actions or any config file.