@speclynx/apidom-overlay 5.2.7 → 6.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,52 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [6.0.6](https://github.com/speclynx/apidom/compare/v6.0.5...v6.0.6) (2026-10-15)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **release:** pass sigstore timeout as a number via publishConfig ([#603](https://github.com/speclynx/apidom/issues/603)) ([3bb44d9](https://github.com/speclynx/apidom/commit/3bb44d9a924741a1f8bbbccebae9b6a2a7cd557b)), closes [#602](https://github.com/speclynx/apidom/issues/602) [#602](https://github.com/speclynx/apidom/issues/602)
11
+
12
+ ## [6.0.5](https://github.com/speclynx/apidom/compare/v6.0.4...v6.0.5) (2026-10-15)
13
+
14
+ **Note:** Version bump only for package @speclynx/apidom-overlay
15
+
16
+ ## [6.0.4](https://github.com/speclynx/apidom/compare/v6.0.3...v6.0.4) (2026-10-15)
17
+
18
+ **Note:** Version bump only for package @speclynx/apidom-overlay
19
+
20
+ ## [6.0.3](https://github.com/speclynx/apidom/compare/v6.0.2...v6.0.3) (2026-10-15)
21
+
22
+ **Note:** Version bump only for package @speclynx/apidom-overlay
23
+
24
+ ## [6.0.2](https://github.com/speclynx/apidom/compare/v6.0.1...v6.0.2) (2026-10-15)
25
+
26
+ **Note:** Version bump only for package @speclynx/apidom-overlay
27
+
28
+ ## [6.0.1](https://github.com/speclynx/apidom/compare/v6.0.0...v6.0.1) (2026-10-15)
29
+
30
+ **Note:** Version bump only for package @speclynx/apidom-overlay
31
+
32
+ # [6.0.0](https://github.com/speclynx/apidom/compare/v5.2.7...v6.0.0) (2026-10-15)
33
+
34
+ ### Bug Fixes
35
+
36
+ - **overlay:** guard apply against reference options ([90a51c0](https://github.com/speclynx/apidom/commit/90a51c0d55b1446bab68d1b3cae07b2f352711b6))
37
+ - **overlay:** normalize overlay URI used for dereferencing ([627fc01](https://github.com/speclynx/apidom/commit/627fc0177749dbcdccb3df2877f85c5f3770cc94))
38
+ - **overlay:** trace unresolvable reusable action references ([28f66b6](https://github.com/speclynx/apidom/commit/28f66b63b185c65056f3dd0647721685b8fa5fa3))
39
+
40
+ ### Features
41
+
42
+ - **overlay:** apply reusable action references ([3518793](https://github.com/speclynx/apidom/commit/35187935737810b65e7f15c0422a20bd409add91))
43
+ - **overlay:** dereference overlays before applying them ([ad0b84b](https://github.com/speclynx/apidom/commit/ad0b84b4c0121403d8156a3f8521ccb4cf87bc44))
44
+ - **overlay:** emit Overlay 1.2.0 from diff by default ([56fd656](https://github.com/speclynx/apidom/commit/56fd656fd4f3da97826d6be4dd534bdc29363f97))
45
+
46
+ ### BREAKING CHANGES
47
+
48
+ - **overlay:** applyOverlayApiDOM and applyOverlayPOJO now return a
49
+ Promise. Await their results. The new `reference` option configures
50
+ dereferencing of the overlay.
51
+
6
52
  ## [5.2.7](https://github.com/speclynx/apidom/compare/v5.2.6...v5.2.7) (2026-10-13)
7
53
 
8
54
  **Note:** Version bump only for package @speclynx/apidom-overlay
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @speclynx/apidom-overlay
2
2
 
3
- `@speclynx/apidom-overlay` applies [Overlay 1.x.y](https://spec.openapis.org/overlay/v1.1.0.html) documents to API definitions
3
+ `@speclynx/apidom-overlay` applies [Overlay 1.x.y](https://spec.openapis.org/overlay/v1.2.0.html) documents to API definitions
4
4
  and can generate overlays by diffing two API documents.
5
- The [Overlay Specification](https://spec.openapis.org/overlay/v1.1.0.html) defines a mechanism for modifying
5
+ The [Overlay Specification](https://spec.openapis.org/overlay/v1.2.0.html) defines a mechanism for modifying
6
6
  existing API documents without directly editing the original, using [JSONPath (RFC 9535)](https://www.rfc-editor.org/rfc/rfc9535.html)
7
7
  expressions to target specific nodes and apply updates, copies, or removals.
8
8
 
@@ -38,17 +38,22 @@ const yaml = toYAML(result.api, { preserveStyle: true });
38
38
  ### Applying to ApiDOM elements
39
39
 
40
40
  `applyOverlayApiDOM` applies an entire overlay document to a target element. Accepts `Overlay1Element`
41
- or `ParseResultElement`. Immutable by default. Returns a new element, even when no action
41
+ or `ParseResultElement`. Immutable by default. Returns a promise of a new element, even when no action
42
42
  changes anything. When the target is a `ParseResultElement`, a new parse result is returned
43
43
  and the one passed in is left untouched.
44
44
 
45
+ All overlay-level functions (`applyOverlay`, `applyOverlayApiDOM` and `applyOverlayPOJO`) are asynchronous:
46
+ the overlay is dereferenced with [@speclynx/apidom-reference](https://github.com/speclynx/apidom/tree/main/packages/apidom-reference)
47
+ before any action is applied, so Overlay 1.2.0 Reusable Action References are applied as the Action Objects they resolve to.
48
+ Applying a single action (`applyActionApiDOM`, `applyActionPOJO`) stays synchronous.
49
+
45
50
  ```js
46
51
  import { refract } from '@speclynx/apidom-datamodel';
47
52
  import { refractOverlay1 } from '@speclynx/apidom-ns-overlay-1';
48
53
  import { applyOverlayApiDOM } from '@speclynx/apidom-overlay';
49
54
 
50
55
  const overlay = refractOverlay1({
51
- overlay: '1.1.0',
56
+ overlay: '1.2.0',
52
57
  info: { title: 'My overlay', version: '1.0.0' },
53
58
  actions: [
54
59
  { target: '$.info', update: { description: 'Added by overlay' } },
@@ -60,7 +65,7 @@ const target = refract({
60
65
  info: { title: 'Original', version: '1.0.0' },
61
66
  });
62
67
 
63
- const result = applyOverlayApiDOM(overlay, target);
68
+ const result = await applyOverlayApiDOM(overlay, target);
64
69
  ```
65
70
 
66
71
  `applyActionApiDOM` applies a single overlay action. Useful for programmatic, step-by-step application.
@@ -88,9 +93,9 @@ no need to manually refract or serialize.
88
93
  import { applyOverlayPOJO, applyActionPOJO } from '@speclynx/apidom-overlay';
89
94
 
90
95
  // full overlay
91
- const result = applyOverlayPOJO(
96
+ const result = await applyOverlayPOJO(
92
97
  {
93
- overlay: '1.1.0',
98
+ overlay: '1.2.0',
94
99
  info: { title: 'My overlay', version: '1.0.0' },
95
100
  actions: [
96
101
  { target: '$.info.title', update: 'Renamed API' },
@@ -137,7 +142,7 @@ const overlay = diffApiDOM(left, right, {
137
142
  });
138
143
 
139
144
  // overlay is an Overlay1Element — serialize or apply it directly
140
- const updated = applyOverlayApiDOM(overlay, left);
145
+ const updated = await applyOverlayApiDOM(overlay, left);
141
146
  console.log(toValue(updated)); // equals toValue(right)
142
147
  ```
143
148
 
@@ -150,7 +155,7 @@ const overlay = diffPOJO(
150
155
  { info: { title: 'Old', version: '1.0.0' } },
151
156
  { info: { title: 'New', version: '2.0.0' } },
152
157
  );
153
- // overlay is a plain object: { overlay: '1.1.0', info: {...}, actions: [...] }
158
+ // overlay is a plain object: { overlay: '1.2.0', info: {...}, actions: [...] }
154
159
  ```
155
160
 
156
161
  `diffOverlay` parses two documents from file paths or URLs and returns an `Overlay1Element`.
@@ -179,7 +184,7 @@ const overlay = await diffOverlay(
179
184
 
180
185
  | Option | Type | Default | Description |
181
186
  |---|---|---|---|
182
- | `overlay` | `string` | `'1.1.0'` | Version string written to the `overlay` field. Configurable because 1.0.0 and 1.1.0 have slightly different semantics. |
187
+ | `overlay` | `string` | `'1.2.0'` | Version string written to the `overlay` field. Generated overlays use no 1.2.0-only features, so pass `'1.1.0'` (or `'1.0.0'`) to target an older version. |
183
188
  | `info.title` | `string` | `'API diff'` | Title for the generated overlay's `info` object. |
184
189
  | `info.version` | `string` | `'0.0.0'` | Version for the generated overlay's `info` object. |
185
190
  | `info.description` | `string` | — | Optional description for the overlay's `info` object. |
@@ -198,7 +203,7 @@ The diff walks both element trees recursively and generates [JSONPath (RFC 9535)
198
203
 
199
204
  | Limitation | Details |
200
205
  |---|---|
201
- | Empty actions on identical documents | By default, identical inputs produce an overlay with an empty `actions` array (Overlay 1.1.0 §3 requires non-empty). Use `onEmptyDiff: 'throw'` to turn this into an `OverlayError` instead. |
206
+ | Empty actions on identical documents | By default, identical inputs produce an overlay with an empty `actions` array (Overlay 1.x §3 requires non-empty). Use `onEmptyDiff: 'throw'` to turn this into an `OverlayError` instead. |
202
207
  | Root structural type change | Throws `OverlayError`. Overlay has no mechanism to replace the root node. |
203
208
  | Array insert-at-position | Overlay 1.x has no insert primitive. Positional diffing cascades replacements + appends, which is always correct but may be verbose for large array reorderings. |
204
209
  | Array item structural type change | Handled via tail-reconstruct: items from the first type-mismatched index onward are removed and re-appended. Always correct, but produces more actions than a minimal diff. |
@@ -206,7 +211,7 @@ The diff walks both element trees recursively and generates [JSONPath (RFC 9535)
206
211
 
207
212
  ## Overlay spec semantics
208
213
 
209
- The implementation follows [Overlay 1.1.0](https://spec.openapis.org/overlay/v1.1.0.html) merge rules:
214
+ The implementation follows [Overlay 1.2.0](https://spec.openapis.org/overlay/v1.2.0.html) merge rules:
210
215
 
211
216
  | Scenario | Behavior |
212
217
  |---|---|
@@ -218,6 +223,8 @@ The implementation follows [Overlay 1.1.0](https://spec.openapis.org/overlay/v1.
218
223
  | Multiple targets | All must be the same type (all objects, all arrays, or all primitives) |
219
224
  | `remove: true` | Removes matched nodes; when combined with `update`, the update has no effect |
220
225
  | Action ordering | Applied sequentially — each action modifies the result of the previous |
226
+ | Reusable Action Reference | Resolved by dereferencing the overlay before any action is applied: the reference becomes the Action from `components.actions` of the same overlay, supplying `target`, and its `description` wins. Unresolvable references reject with `OverlayError` and no action is applied |
227
+ | `$self` | When applying from file/URL, a relative `extends` is resolved against `$self` (itself resolved against the overlay's URI) |
221
228
 
222
229
  ## Tracing
223
230
 
@@ -229,7 +236,7 @@ information about every action applied.
229
236
  import { applyOverlayApiDOM } from '@speclynx/apidom-overlay';
230
237
 
231
238
  const trace = {};
232
- const result = applyOverlayApiDOM(overlay, target, { trace });
239
+ const result = await applyOverlayApiDOM(overlay, target, { trace });
233
240
 
234
241
  console.log(trace.failed); // false
235
242
  console.log(trace.message); // 'Overlay was successfully applied'
@@ -248,7 +255,7 @@ When an action fails, the trace captures the error before it is re-thrown:
248
255
  ```js
249
256
  const trace = {};
250
257
  try {
251
- applyOverlayApiDOM(overlay, target, { trace });
258
+ await applyOverlayApiDOM(overlay, target, { trace });
252
259
  } catch (error) {
253
260
  console.log(trace.failed); // true
254
261
  console.log(trace.failedAt); // index of the failed action
@@ -257,6 +264,10 @@ try {
257
264
  }
258
265
  ```
259
266
 
267
+ `applyOverlay`, `applyOverlayApiDOM` and `applyOverlayPOJO` dereference the overlay before any action runs.
268
+ If that fails, for example because of an unresolvable Reusable Action Reference, the promise rejects with
269
+ `OverlayError` and the trace object is left untouched, since no action was attempted.
270
+
260
271
  Tracing works across all API levels — ApiDOM elements, file/URL, and POJO:
261
272
 
262
273
  ```js
@@ -271,7 +282,7 @@ await applyOverlay('/path/to/overlay.yaml', undefined, { trace });
271
282
 
272
283
  // POJO
273
284
  const trace = {};
274
- applyOverlayPOJO(overlay, target, { trace });
285
+ await applyOverlayPOJO(overlay, target, { trace });
275
286
  ```
276
287
 
277
288
  ## Options
@@ -289,8 +300,11 @@ Passed to `applyActionApiDOM`, `applyOverlayApiDOM`, and `applyOverlay`:
289
300
 
290
301
  ### ApplyOverlayOptions
291
302
 
292
- Extends `ApplyOptions` with all [`@speclynx/apidom-reference` options](https://github.com/speclynx/apidom/blob/main/packages/apidom-reference/README.md)
293
- for controlling parsing, resolving, and dereferencing of the overlay and target documents.
303
+ Passed to `applyOverlay`, `applyOverlayApiDOM`, and `applyOverlayPOJO`. Extends `ApplyOptions` with a `reference` field:
304
+
305
+ | Option | Type | Default | Description |
306
+ |---|---|---|---|
307
+ | `reference` | `PartialDeep<ReferenceOptions>` | — | [`@speclynx/apidom-reference` options](https://github.com/speclynx/apidom/blob/main/packages/apidom-reference/README.md) for dereferencing the overlay (and, in `applyOverlay`, for parsing the overlay and target documents). |
294
308
 
295
309
  ### DiffOverlayOptions
296
310
 
@@ -298,7 +312,7 @@ Passed to `diffOverlay`. Extends `DiffOptions` with a `reference` field:
298
312
 
299
313
  | Option | Type | Default | Description |
300
314
  |---|---|---|---|
301
- | `overlay` | `string` | `'1.1.0'` | Inherited from `DiffOptions`. See [DiffOptions](#diffoptions). |
315
+ | `overlay` | `string` | `'1.2.0'` | Inherited from `DiffOptions`. See [DiffOptions](#diffoptions). |
302
316
  | `info` | `object` | — | Inherited from `DiffOptions`. |
303
317
  | `extends` | `string` | `leftURI` | When omitted, automatically set to `leftURI` so the overlay points back to the base document. |
304
318
  | `reference` | `PartialDeep<ReferenceOptions>` | — | [`@speclynx/apidom-reference` options](https://github.com/speclynx/apidom/blob/main/packages/apidom-reference/README.md) for parsing the left and right documents. |