OpenAPI Validator and Inspector
Validate OpenAPI 3.0 and 3.1 spec files — lint errors, missing fields, and schema compliance.
Published:
Tags: OpenAPI validator, Swagger OpenAPI validator, API spec validation
OpenAPI Validator and Inspector An OpenAPI validator checks your API specification against the OpenAPI standard — catching missing fields, unresolved references, invalid schemas, and linting issues before they reach code generation or documentation pipelines. --- What OpenAPI Validation Catches? Validation operates at three levels: Structural validation — verifies the document conforms to the OpenAPI 3.x JSON Schema. Catches missing required fields, wrong value types, and schema constraint violations. Semantic validation — verifies references resolve, operationIds are unique, parameters are correctly typed, and response codes are valid HTTP status codes. Lint rules — style and best-practice checks: consistent naming, required descriptions, deprecated field usage, and security scheme…
Frequently Asked Questions
How do I validate an OpenAPI spec?
Paste your YAML or JSON spec into a validator tool. It checks required fields (openapi, info, paths), verifies $ref paths resolve to defined components, validates HTTP methods and status codes, and checks schema types against the JSON Schema subset used by OpenAPI.
What are common OpenAPI validation errors?
Common errors include missing required fields (title, version), unresolved $ref paths, invalid HTTP status codes, missing operationId values, response schemas without a description, and parameters without a `in` field. A linter catches all of these.
What is the difference between OpenAPI 3.0 and 3.1?
OpenAPI 3.1 aligns fully with JSON Schema 2020-12, supports webhooks, and allows $ref alongside sibling keywords. OpenAPI 3.0 uses a restricted subset of JSON Schema Draft 07. For new APIs, prefer 3.1 unless your toolchain hasn't caught up.
How do I lint an OpenAPI file?
Tools like Spectral (Stoplight), vacuum, and openapi-validator apply rule sets to your spec. Rules check naming conventions (camelCase operationIds, lowercase paths), require descriptions, and flag deprecated patterns.
What tools validate OpenAPI specs?
Browser tools, Spectral CLI (`spectral lint openapi.yaml`), Redocly CLI (`redocly lint`), and the openapi-validator npm package are the most common. Integrated tools like Stoplight Studio validate in real time as you type.
All articles · theproductguy.in