Skip to content

OpenAPI validator and linter

Runs in your browser. Nothing is uploaded.

Check an OpenAPI file against best-practice, OWASP security and documentation rules, with its agent-readiness score and a fix for each finding.

Input

openapi: "3.1.0"
info:
  title: Petstore
  version: 1.0.0
  description: A sample API that uses a pet store as an example.
  license:
    name: MIT
    identifier: MIT
servers:
  - url: https://petstore.example.com/v1
tags:
  - name: pets
    description: Everything about your pets
paths:
  /pets:
    get:
      summary: List all pets
      description: Returns the pets in the store, a page at a time.
      operationId: listPets
      tags:
        - pets
      parameters:
        - name: limit
          in: query
          description: How many items to return at one time (max 100)
          required: false
          schema:
            type: integer
            format: int32
      responses:
        "200":
          description: A page of pets
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pets"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
    post:
      summary: Create a pet
      tags:
        - store
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Pet"
      responses:
        "201":
          description: The pet was created
  /pets/{petId}:
    get:
      summary: Info for a specific pet
      operationId: showPetById
      tags:
        - pets
      responses:
        "200":
          description: The pet
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pet"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
components:
  schemas:
    Pet:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        tag:
          type: string
    Pets:
      type: array
      items:
        $ref: "#/components/schemas/Pet"
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string

Result

Paste, upload or load a file to start

How it works

Paste, upload or load an OpenAPI file and the validator lints it with Spectral and the rule set you pick, then computes the agent-readiness score of apigit score. Both run in your browser, about half a second after you stop typing. Each finding has its line (click it to move the editor there) and, where one exists, a link to a page that explains the message and its fix.

The sample is a small pet store in OpenAPI 3.1 with a few faults left in. With the default rule set the validator reports:

1 error, 5 warnings; agent-readiness score 83 of 100

line 2   warn  info-contact           Info object must have "contact" object.
line 43  warn  operation-description  Operation "description" must be present and non-empty string.
line 43  warn  operation-operationId  Operation must have "operationId".
line 46  warn  operation-tag-defined  Operation tags must be defined in global tags.
line 56  error path-params            Operation must define parameter "{petId}" as expected by path "/pets/{petId}".
line 56  warn  operation-description  Operation "description" must be present and non-empty string.

Rules that lost points
Operations have an operationId: fails for 1 of 3 operations · weight 3
Operations have a description: fails for 2 of 3 operations · weight 2
Operations document an error response: fails for 1 of 3 operations · weight 2

The error is the one that breaks tools: /pets/{petId} has a path parameter no operation declares. The warnings are about documentation, and three of them also cost points of the agent-readiness score, because an agent reads operationIds, descriptions and error responses to decide what to call.

What it does not do

  • It does not send your file anywhere, and it does not keep it: the last input stays in this browser's storage until you click Clear.
  • A $ref to another file of a pasted spec is reported as not followed. Load the spec from its URL (relative references on the same host are then read) or bundle the files first with the OpenAPI bundler.
  • A $ref to another host, to localhost or to a private address is never fetched.
  • It does not take your own rule set file or your organization's rules; the CLI and APIGit do.
  • It does not call your API. It checks the description, not the running service.

This tool and APIGit

This toolWith APIGit
Four built-in rule sets, one file at a timeThe best-practice and OWASP rule sets in the editor's Governance view, beside the file you are changing; all four in the CLI
Findings for the file you pasteA Governance tab on each pull request of an organization repository, for every changed spec
Your own rules: noCustom rule profiles and governance policies for an organization (Enterprise plan)
Check by handapigit lint in CI, or the GitHub Action; --report-status posts the commit status apigit/lint, which branch protection can require before a merge
A score for one fileapigit score openapi.yaml --min 80 fails a build below the score you set

Questions and answers

Is my OpenAPI file uploaded anywhere?
No. The checks run in a Web Worker in your browser. A pasted or uploaded file fetches nothing; a file loaded from a URL is fetched by your browser from that host, with its relative $refs from the same host only.
Which rules does the validator use?
The four built-in rule sets of the APIGit CLI: best practice (the default), OWASP API Security Top 10, URL style and documentation quality. They are Spectral rule sets; best practice and OWASP are also the two predefined rule sets of APIGit's Governance view.
What is the agent-readiness score?
A number from 0 to 100 for how well an AI agent can use the API, as apigit score computes it: operationIds, summaries, descriptions, error responses, response schemas, parameter descriptions and a server, each with a weight. It is not a general quality grade.
Does it validate against the OpenAPI schema too?
Yes. The best-practice rule set includes Spectral's structural checks (oas2-schema, oas3-schema), so a missing required field such as info.version, or a value of the wrong type, is reported with its line.
Can I use my own Spectral rule set?
Not on this page. The CLI takes one with apigit lint --ruleset, or a .spectral.yaml in the working directory, and an organization on APIGit can keep its own rule profiles.
How do I run the same check on every pull request?
Add the GitHub Action apigitlabs/apigit-action@v1 with run: lint openapi.yaml --format github-actions. Each finding then appears on its line in the pull request.
What is the largest file it checks?
5 MB. A larger file gets a message instead of a frozen tab; the CLI has no such limit.