Skip to content

Latest commit

 

History

History
59 lines (43 loc) · 1.63 KB

configure-rules.md

File metadata and controls

59 lines (43 loc) · 1.63 KB

Configure linting rules

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.

Simple rule configuration

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.

Per-API 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.

Resources