Last updated

apis

Introduction

If your project contains multiple APIs, you can use the apis configuration section to set up rules and settings for individual APIs.

Options

OptionTypeDescription
{name}@{version}API objectREQUIRED. Each API needs a name and optionally a version. Supports alphanumeric characters and underscores.

API object

OptionTypeDescription
rootstringREQUIRED. Path to the root API description file.
rulesRules objectAdditional rule configuration for this API.
decoratorsDecorators objectAdditional decorator configuration for this API.
preprocessorsDecorators objectPreprocessors run before linting, and follow the same structure as decorators. We recommend the use of decorators over preprocessors in most cases.
outputOutput file pathWhen running bundle without specifying an API, the bundled API description is saved to this location.

Examples

The following example shows a simple redocly.yaml configuration file with settings for multiple APIs.

apis:
  orders@v3:
    root: orders/openapi.yaml
    rules:
      tags-alphabetical: error
      operation-operationId-unique: error
      spec-strict-refs: error
  newsletter:
    root: newsletter/openapi.yaml
    rules:
      info-contact: off
      operation-summary: off

The following example shows redocly.yaml configuration file with settings for multiple APIs outputs.

apis:
  main@v1:
    root: openapi-v1.yaml
    output: v1/bundled.yaml
  main@v2:
    root: openapi-v2.yaml
    output: v2/bundled.yaml

When running redocly bundle with this config, the bundled API descriptions are saved to the corresponding location.

Resources