OpenAPI / Swagger Validator
DataValidate an OpenAPI 3.x or Swagger 2.0 specification for required fields and structural correctness. Paste JSON or YAML. Free, client-side, no data uploaded.
Reviewed by the thecalcu.com team · Last updated July 30, 2026
What is a OpenAPI?
The OpenAPI / Swagger Validator checks whether an API specification document contains all required structural fields and correctly identifies its version, OpenAPI 3.x or Swagger 2.0. Paste your spec in JSON or YAML format and the tool reports: the detected spec version, total endpoint count, and the specific required fields that are missing, if any.
OpenAPI (formerly Swagger) is the de-facto standard for describing REST APIs. A valid spec is the foundation of every downstream tool in the API lifecycle, documentation generators like Redoc and Swagger UI, mock servers, API gateway configurations, SDK generators, and contract testing frameworks all parse the spec before doing anything else. An invalid spec, missing info.title, no paths, or an unrecognised root key, breaks these tools silently or with cryptic errors far removed from the actual problem in the spec file.
This validator performs a structural check: it confirms the required root-level fields are present and reports the endpoint count. It does not resolve $ref pointers, validate individual schema definitions, or check whether response body shapes match declared schemas. For full semantic linting, the scope disclaimer is explicit: use Redocly CLI or the Swagger Editor for production-ready spec validation. For pure syntax validation of YAML specs, the YAML Validator is the complementary tool.
Validation runs entirely in your browser. Your spec content is never transmitted to a server or stored anywhere, safe for pre-release or internal API definitions.
Why Use an OpenAPI Validator?
A missing required field in an OpenAPI spec does not throw an error at authoring time, the YAML or JSON itself is syntactically valid. The failure surface is downstream: a documentation generator that renders an empty page, a code generator that crashes on a null info.title, or an API gateway import that rejects the spec without a helpful error message.
Common scenarios where this tool saves time:
- Checking a hand-written spec for required fields before running
redocly bundleor importing into API Gateway - Confirming the spec version is correctly declared (
openapi: "3.0.3"vsswagger: "2.0") before passing it to a version-specific tool - Quickly counting total endpoints in a spec during API surface area reviews
- Verifying a spec exported from Postman or Stoplight has all required fields before handing it to another team
- Catching a broken YAML paste (spec pasted without proper indentation) before it causes a confusing downstream failure
The structural check here is fast and client-side, no toolchain required, no CLI to install, no account needed.
Who Should Use This Validator?
API developers and architects writing or reviewing OpenAPI specs by hand, validate required fields and version detection instantly without leaving the browser.
Backend engineers integrating with API gateways (AWS API Gateway, Kong, Azure API Management) that import OpenAPI specs, confirm the spec is well-formed before an import that fails mid-way through and leaves gateway configuration in a partial state.
DevOps and platform engineers building CI/CD pipelines that generate or bundle OpenAPI specs, add a quick structural check before the generated spec is consumed by documentation or code generation stages.
Technical writers and developer advocates maintaining public API reference documentation, catch missing info.title or info.version values that would produce malformed documentation headers.
QA engineers and contract testers setting up consumer-driven contract tests, confirm the spec has the required structure before configuring tools like Pact or Dredd.
For full semantic linting with $ref resolution and schema-level validation, use Redocly CLI or the Swagger Editor alongside this tool. For validating the raw JSON or YAML syntax before working with the spec structure, use the JSON Validator or YAML Validator.
What Insights Does the OpenAPI Validator Give You?
When the spec is valid, the output panel shows:
- Spec version, the exact version string from the
openapiorswaggerkey (e.g.,3.0.3or2.0) - Endpoint count, total number of HTTP operations across all paths (each
get,post,put, etc. on each path counts as one endpoint) - Valid badge, confirming all required structural fields are present
When the spec is invalid, the output shows:
- Invalid badge
- Missing fields, the specific required fields that were not found (e.g.,
info.title,info.version,paths) - Format issue, if neither
openapinorswaggerroot keys are present, the tool reports an unrecognised format
Scope disclaimer: this is a structural required-field check, not a full semantic validator. The following are outside scope: $ref resolution, per-property schema type validation, response body shape checking, security scheme completeness, and OpenAPI extension (x-) field validation. For a complete linting report, use Redocly CLI (redocly lint) or the Swagger Editor at editor.swagger.io.
How to use this OpenAPI calculator
- Paste your OpenAPI 3.x or Swagger 2.0 specification into the spec input area. The default example shows a minimal valid OpenAPI 3.0.3 document in YAML format, you can paste JSON or YAML.
- The tool processes your input automatically. No submit button is needed.
- Check the Valid or Invalid badge at the top of the result panel.
- If Valid: read the details, confirm the detected spec version is correct and review the endpoint count to ensure all paths are being read as expected.
- If Invalid: read the details list of missing fields. Each missing field is listed by its full dotted path (e.g.,
info.version) so you can locate it directly in your spec. - Fix the reported fields in your spec, paste the corrected version back, and re-validate until the Valid badge appears.
- Once the structural check passes, run a full linter (Redocly CLI or Swagger Editor) for deeper schema and reference validation before publishing or importing the spec.
Show formula & methodology ↓Show less ↑
Formula & Methodology
### Version Auto-Detection The tool reads the root of the parsed document for two keys: -openapikey present → classified as OpenAPI 3.x. The value (e.g.,"3.0.3","3.1.0") is reported as the spec version. -swaggerkey present → classified as Swagger 2.0. The value (e.g.,"2.0") is reported as the spec version. - Neither key present → reported as unrecognised format. ### Required Fields by Spec Version OpenAPI 3.x required fields: | Field | Location | Rule | |---|---|---| |openapi| Root | Must be present; value must start with3.| |info.title|infoobject | Non-empty string | |info.version|infoobject | Non-empty string | |paths| Root | Must be present and contain at least one path with at least one HTTP method operation | Swagger 2.0 required fields: | Field | Location | Rule | |---|---|---| |swagger| Root | Must equal"2.0"| |info.title|infoobject | Non-empty string | |info.version|infoobject | Non-empty string | |paths| Root | Must be present and contain at least one path with at least one HTTP method operation | ### JSON vs YAML Handling JSON input: the spec is fully parsed usingJSON.parse(). All required field lookups traverse the parsed object tree precisely. YAML input: the tool performs structural key extraction using heuristic pattern matching on the raw YAML text. Top-level keys (e.g.,openapi:,info:,paths:) and first-level nested keys underinfo:(e.g.,title:,version:) are identified by scanning for key patterns at the expected indentation levels. This approach correctly handles standard YAML formatting. Deeply nested$refpointers, custom anchors, and non-standard indentation may not be fully resolved, use the YAML Validator first if your spec has unusual formatting. ### Endpoint Count Calculation The tool counts HTTP method operations by looking for the standard HTTP method keys (get,post,put,patch,delete,head,options,trace) under each path item inpaths. Each method key found under a path counts as one endpoint. This matches how Postman, Stoplight, and Redocly count API operations. Valid minimal OpenAPI 3.x example (JSON):json { "openapi": "3.0.3", "info": { "title": "My API", "version": "1.0.0" }, "paths": { "/users": { "get": { "summary": "List users", "responses": { "200": { "description": "OK" } } } } } }Result: Valid, OpenAPI 3.0.3, 1 endpoint detected. Invalid example (missinginfo.version):yaml openapi: "3.0.3" info: title: My API paths: /users: get: summary: List users responses: "200": description: OKResult: Invalid, missing field:info.version.
Frequently Asked Questions