You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+19-7Lines changed: 19 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1201,22 +1201,25 @@ operationIds:
1201
1201
The OpenAPI Overlay functionality allows users to apply actions such as updates and removals to an OpenAPI Specification (OAS). This feature is useful for dynamically modifying OAS documents during development, testing, or publishing workflows.
1202
1202
1203
1203
### What is an OpenAPI Overlay?
1204
-
An [OpenAPI Overlay](https://spec.openapis.org/overlay/v1.0.0.html) is a specification that defines a structured set of actions to be applied to an existing OpenAPI document. It enables:
1204
+
An [OpenAPI Overlay](https://spec.openapis.org/overlay/v1.1.0.html) is a specification that defines a structured set of actions to be applied to an existing OpenAPI document. It enables:
1205
1205
1206
1206
- Updating existing fields, such as descriptions, parameters, or endpoints.
1207
1207
- Adding new fields or objects to the OpenAPI document.
1208
1208
- Removing fields or objects that are no longer relevant.
1209
+
- Copying values from one location in the source document to another location.
1209
1210
1210
1211
An overlay document follows the structure below:
1211
1212
1212
-
```
1213
-
overlay: 1.0.0
1213
+
```yaml
1214
+
overlay: 1.1.0
1214
1215
info:
1215
1216
title: Example Overlay
1217
+
description: Overlay to add docs metadata and copy values
1216
1218
version: 1.0.0
1219
+
x-overlay-owner: docs-team
1217
1220
actions:
1218
-
- target: "$" // JSONPath definition of the targetted element of the document
1219
-
update: // The action to be applied: updateor remove
1221
+
- target: "$" # JSONPath definition of the targeted element of the document
1222
+
update: # The action to be applied: update, remove, or copy
1220
1223
info:
1221
1224
description: "Updated description for the OpenAPI specification."
1222
1225
- target: "$.paths['/example']"
@@ -1225,9 +1228,12 @@ actions:
1225
1228
description: "Updated GET description for /example endpoint."
1226
1229
- target: "$.paths['/example'].get.parameters"
1227
1230
remove: true # Example of removing an element
1231
+
- target: "$.info.title"
1232
+
copy: true
1233
+
from: "$.info.version"
1228
1234
```
1229
1235
1230
-
Fore more information about the OpenAPI Overlay options, see [OpenAPI Overlay Specification 1.0.0](https://www.openapis.org/blog/2024/10/22/announcing-overlay-specification)
1236
+
Fore more information about the OpenAPI Overlay options, see [OpenAPI Overlay Specification 1.1.0](https://spec.openapis.org/overlay/v1.1.0.html).
1231
1237
1232
1238
Use the `--overlayFile` option to specify the overlay file and apply it to your OpenAPI document.
You can also let the overlay declare the base OpenAPI document using the top-level `extends` property. When `extends` is present, the input file argument becomes optional:
0 commit comments