Skip to content

Commit f0446c7

Browse files
authored
docs(all): clarifies what is overridden on a per-api basis (#1882)
* docs(all): clarifies what is overridden on a per-api basis * docs(all): adds first-level properties wording * docs(all): updates based on review * docs(all): updates based on review * docs(all): fixes lint issue * docs(all): fixes prettier issue * docs(all): updates based on review
1 parent f443760 commit f0446c7

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

docs/configuration/apis.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,34 @@ Every `name@version` combination listed in the object must be unique.
88
For every API listed in the object, you must provide the path to the OpenAPI description using the `root` property.
99

1010
If `rules`, `decorators`, or `preprocessors` aren't defined for an API, root settings are used.
11-
If `rules`, `decorators`, or `preprocessors` are defined for an API, its settings apply together with the root configuration.
12-
If per-API and root settings modify the same properties, per-API settings overrides root settings.
11+
If `rules`, `decorators`, or `preprocessors` are defined for an API, they apply together with the root configuration.
12+
If the same `rules`, `decorators`, or `preprocessors` are defined on `apis` and the root level, per-API `rules`, `decorators`, and `preprocessors` override the root ones.
13+
14+
For example, if you include the same `decorator` at the root level and for a specific API, but with different properties, the API-level settings replace the root ones.
15+
16+
So if you have the following `redocly.yaml` configuration, adding `filter-in` and `plugin/change-title` at the root level and applying `plugin/change-title` with a different `title` property to the `storefront@latest` API:
17+
18+
```yaml
19+
decorators:
20+
filter-in:
21+
property: x-products
22+
value:
23+
- Core
24+
plugin/change-title:
25+
title: All APIs
26+
extraProperty: This property will be ignored at the per-API level.
27+
28+
29+
apis:
30+
storefront@latest:
31+
decorators:
32+
plugin/change-title:
33+
title: Storefront APIs
34+
```
35+
36+
The `plugin/change-title` decorator with the "Storefront APIs" `title` property is applied to the `storefront@latest` API with the value `Storefront APIs`, and the `filter-in` decorator is also applied to the `storefront@latest` API.
37+
38+
For all other APIs, not including the `storefront@latest` API, `filter-in` and `plugin/change-title` with the "Core" `title` and `extraProperty` properties are applied.
1339

1440
## Patterned properties
1541

0 commit comments

Comments
 (0)