Operating OpenAPI lint standards: from legacy APIs to CI gates
An OpenAPI linter repeatedly checks both description structure and your team's API design rules. Applying strict rules to a legacy API all at once can create so much noise that teams disable linting. Choose a baseline, tune severity, track exceptions, then apply the gate to new changes in stages. This guide uses Redocly CLI's documented lint command; behavior can vary by tool and ruleset version.
An OpenAPI linter repeatedly checks both description structure and your team's API design rules. Applying strict rules to a legacy API all at once can create so much noise that teams disable linting. Choose a baseline, tune severity, track exceptions, then apply the gate to new changes in stages. This guide uses Redocly CLI's documented lint command; behavior can vary by tool and ruleset version.
Prepare the scope
Identify root OpenAPI files and referenced files in the repository.
Separate contract requirements (such as security declarations, operation identifiers, and response shape) from style preferences.
Pin the linter package version in the lockfile so local and CI use the same release and rules.
The current CLI v2 docs require Node.js 22.12.0 or newer. Check `node --version` and `redocly --version`, then verify the installed release's requirements.
Linting is automated feedback on syntax/specification and team rules. A clean run does not prove the design is usable or the server matches it. Review security, runtime behavior, and consumer compatibility with suitable checks.
Start with low friction for an existing API
Run redocly lint openapi.yaml to inspect the document. Without a configuration file, the documented default ruleset is recommended; for an existing API that does not yet meet the standard, start by exploring minimal:
redocly lint --extends minimal openapi.yamlResults show file location, rule ID, severity, and message. Classify repeated structural defects and issues that can confuse consumers or create risk. Do not silence every finding just because the list is long; adjust the ruleset and severity policy.
Share a reusable rules configuration
Put redocly.yaml at the repository root so developers and CI use the same standard:
extends:
- recommended
rules:
operation-operationId: warn
no-server-trailing-slash: errorextends selects a base ruleset; rules adjusts individual rules. In Redocly, error fails validation, warn reports a warning and can still pass if there are no errors, and off skips that rule. The sample expresses one possible team policy, not a universal recommendation. Review why each rule matters to your API.
Rerun:
redocly lint openapi.yamlA useful pass condition is: the intended ruleset is applied, there are zero errors, and every remaining warning has an owner or resolution plan. For CI reporting, Redocly supports formats such as --format=github-actions, --format=junit, and --format=markdown. A report format changes how findings are displayed, not what a rule means.
Keep exceptions narrow and reviewable
If one legacy operation cannot meet a rule, disabling the rule globally can hide future violations. First check whether the description can be safely corrected. For an unavoidable exception, scope it to the file, JSON Pointer, and rule ID. Redocly can generate .redocly.lint-ignore.yaml:
redocly lint openapi.yaml --generate-ignore-fileReview every generated entry; record its rationale, owner, and revisit date. The command can update entries for the API files you pass, so specify the intended files and inspect the diff. Setting a rule to off affects its full scope and is broader than a path-specific exception.
Prevent regressions in CI
Use the same lockfile and `redocly.yaml` locally and in CI.
Run `redocly lint` on every root description changed in a pull request.
Block merges on errors; initially track warning trends and owners.
Raise severity for important rules as the baseline stabilizes.
When upgrading the linter or ruleset, review release notes, new findings, and ignore-file changes.
If findings spike, inspect rule configuration, specification changes, and tool upgrades before adding many exceptions. Fix configuration diagnostics and rerun. For a real legacy exception, narrow and document it, then review the specification and ignore-file diff together.
Sources
[Redocly CLI: lint command](https://redocly.com/docs/cli/commands/lint)
[Redocly CLI: rulesets and severity](https://redocly.com/docs/cli/rules)
[Redocly CLI: configure API linting](https://redocly.com/docs/cli/guides/configure-rules)
[Redocly CLI: rules configuration reference](https://redocly.com/docs/cli/configuration/reference/rules)
[Redocly CLI: current runtime requirement](https://redocly.com/docs/cli)