opyeb openapilab

openapilab · Lint

What the linter watches: rules and common mistakes

The error, warning and note levels, and the mistakes that appear most often in real specs.

While reading a document the linter finds places that break a rule and reports each with a severity. Tools disagree about what counts as an error, so showing the diagnostic code matters. This tool names codes by area and rule, such as schema.nullableIn31.

Three severity levels

The errors you meet most

CodeMeaningFix
op.duplicateOperationIdthe same operationId appears twicerename one of them or add a suffix
op.pathParamMissinga template {id} has no in:path parameteradd the parameter with required: true
op.pathParamNotRequiredan in:path parameter lacks required: trueadd required: true
ref.unresolvedthe target of a #/... reference does not existcheck for a typo or a deleted schema
resp.missingDescriptiona response has no descriptionwrite one line about what it means

How path parameters are checked

The tool extracts every {...} from the path string and looks for in: path entries in the combined list of path item and operation parameters. A template without a parameter is an error; a parameter that is not in the template is a warning. Parameters declared on the path item and overridden by the operation are handled too.

Responses and security

Every operation should have a success response (2xx) and an error response (4xx). A document with only default is treated as having no success response. Security may only reference names defined in components.securitySchemes, and schemes or scopes that nothing uses are split between notes and errors.

Zero lint errors does not mean an API is safe. The linter reads form and consistency, not runtime behaviour, authorisation or data exposure.

Questions

Should I remove every warning?

No. Warnings often flag differences in how consumers interpret the document; if the behaviour is intended, leave them. Repeated warnings are a good reason to tighten your conventions.

May operationId contain a hyphen?

The specification allows any string, but generators use it as a function name, so avoid spaces. This tool warns about spaces and unsupported characters and accepts dots, underscores and hyphens.

Is a default response enough without 2xx?

No. default covers codes that no other key matches, so it does not mean success. This tool warns when there is no 2xx response.

Load the legacy preset to see exactly which codes attach to which lines.

Open the tool

Written against the OpenAPI Specification 3.1.0 (2021-02), 3.0.3 and JSON Schema 2020-12. Every example spec and host is synthetic.