OpenAPI / Swagger Validator

Check an OpenAPI 3 or Swagger 2 document, in YAML or JSON, for structural mistakes: missing required fields, broken references, undeclared path parameters, and duplicate operation IDs.

Updated
Runs in your browser. Your data is not uploaded.
Checks as you type for documents up to 200 KB.

How to use the OpenAPI Validator

  1. Paste your spec into OpenAPI document, or upload or drop an openapi.yaml or swagger.json file.
  2. Press Validate. The format and version are detected from the file.
  3. Read the summary, then work through the list of errors and warnings. Each one shows its location as a path such as paths./users/{id}.get.

How it works

The document is parsed as JSON or YAML, then checked against the rules of its version:

  • The root has openapi (3.0.x or 3.1.x) or swagger: "2.0", and an info object with title and version.
  • Every path starts with /, and its keys are valid HTTP methods or allowed extras such as parameters.
  • Every {param} in a path is declared as a parameter with in: path and required: true, and no path parameter is declared that the path doesn't use.
  • Each operation has responses (required in 3.0 and 2.0), and operationId values are unique.
  • Every local $ref such as #/components/schemas/User points to something that exists.
  • Parameters use a valid in value and are not declared twice.

Examples

This fragment has two problems:

openapi: 3.0.3
info:
  title: Users API
  version: 1.0.0
paths:
  /users/{id}:
    get:
      operationId: getUser
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Usr'
  • Error at paths./users/{id}.get: the path parameter id is not declared.
  • Error at paths./users/{id}.get.responses.200.content.application/json.schema: $ref #/components/schemas/Usr doesn't exist.

Limitations

  • This is a structural check of the most common mistakes, not a full validation against the official OpenAPI JSON Schema. For CI, also run a linter such as Spectral or Redocly CLI.
  • External $ref links to other files or URLs are listed but not followed.
  • Schemas inside the spec are not checked against JSON Schema rules. Use the JSON Schema Validator for that.
  • Files are limited to 5 MB.

Frequently asked questions

What is the difference between Swagger and OpenAPI?

Swagger 2.0 was renamed OpenAPI when the specification moved to the OpenAPI Initiative in 2016. OpenAPI 3.0 and 3.1 are the newer versions. People still say "Swagger" for both.

Can I validate a YAML spec?

Yes. YAML and JSON are both accepted, and the format is detected automatically.

Why is my path parameter reported as missing?

Every {name} in a path needs a parameter with the same name, in: path, and required: true, either on the operation or on the path item.

Is my API spec uploaded?

No. It is checked in your browser, so internal API designs stay private.

Often used together with the OpenAPI Validator.