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
$refto 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
$refto another host, tolocalhostor 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 tool | With APIGit |
|---|---|
| Four built-in rule sets, one file at a time | The 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 paste | A Governance tab on each pull request of an organization repository, for every changed spec |
| Your own rules: no | Custom rule profiles and governance policies for an organization (Enterprise plan) |
| Check by hand | apigit 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 file | apigit score openapi.yaml --min 80 fails a build below the score you set |
Questions and answers
Is my OpenAPI file uploaded anywhere?
Which rules does the validator use?
What is the agent-readiness score?
Does it validate against the OpenAPI schema too?
Can I use my own Spectral rule set?
How do I run the same check on every pull request?
What is the largest file it checks?
Learn more
- "Operation must define parameter {id} as expected by path" (path-params)
- "must have required property": which property, where, and why
- "Every operation must have unique operationId" (operation-operationId-unique)
- Lint an OpenAPI file in GitHub Actions, with each finding on its line
- OWASP API Security Top 10: What a linter can see in your OpenAPI document