Configure the rules for API linting in the redocly.yaml
configuration file.
You can add rules, change their severity, or turn them off completely. Some rules support additional configuration.
You can also provide per-format or even per-API rule configuration. Use these approaches when your different types of API, or individual APIs, have different linting requirements.
The following example shows rules configured in redocly.yaml
with short syntax using the format rule-name: {severity}
, where {severity}
is one of error
, warn
or off
:
rules:
operation-operationId: warn
Some rules support additional configuration options. The following example shows the more verbose format where the severity
setting is added alongside other settings:
rules:
path-excludes-patterns:
severity: error
patterns:
- ^\/fetch
- ^\/v[0-9]
Check the documentation for each rule to see if it supports additional configuration.
You can set different rules for individual APIs by adding a rules
object under each API in apis
.
rules:
operation-operationId: error
apis:
museum:
root: ./apis/museum.yaml
rules:
info-license: warn
tickets@beta:
root: ./apis/tickets.yaml
rules:
info-license: error
operation-operationId-url-safe: error
operation-operationId-unique: error
Each API picks up the settings that relate to it and gets linted accordingly.
- Learn more about rules and rulesets.
- Check the list of built-in rules.