Skip to content

fix(overlay): stop dropping members on multi-target actions - #128

Merged
char0n merged 1 commit into
mainfrom
fix/127-update-apidom-packages
Aug 19, 2026
Merged

fix(overlay): stop dropping members on multi-target actions#128
char0n merged 1 commit into
mainfrom
fix/127-update-apidom-packages

Conversation

@char0n

@char0n char0n commented Aug 19, 2026

Copy link
Copy Markdown
Member

Updates the apidom dependency family to the latest releases.

package before after
@speclynx/apidom-core ^5.0.1 ^5.1.1
@speclynx/apidom-ls ^2.11.6 ^2.11.7
@speclynx/apidom-overlay ^5.0.1 ^5.1.1
@speclynx/apidom-reference ^5.0.1 ^5.1.1

Why

apidom 5.1.1 carries the fixes for speclynx/apidom#459 (style-preserving serializers drop shared element instances) and speclynx/apidom#460 (applyUpdateAction merges the same update element into every matched target). Together they resolve #127.

Verification

Reproductions were run against a sandbox pinned to the entire apidom family at 5.1.0 — the versions that would have resolved when #127 was filed — and compared against this branch.

Minimal case$.components.schemas['ActorType', 'CardinalityFilterType'] with a single update:. On 5.1.0 the second match serializes as ? null explicit keys; on 5.1.1 both matches are correct. The JSON output path (which produced quiet null values rather than an obvious syntax oddity) and the copy: case where the source node sits later in the file are both clean as well.

Real FDX spec — FDX 6.4.0 shared components (OpenAPI 3.1.0, with genuine x-fdx-csdf-* extensions), with a reconstructed CSDF filter action:

corrupted ? null members intact x-fdx-csdf-technical: true
apidom 5.1.0 16 24
apidom 5.1.1 0 40

23 pre-existing in source + 17 matched = 40. On 5.1.0 only the first match survived and 16 were lost. Output validates cleanly (9 warnings, all pre-existing example deprecations).

On the open question in #127

The reporter's output showed both ActorType and CardinalityFilterType corrupted, while our reduction only ever corrupted the second-and-later match. That is now accounted for and needs no further fix.

The cause was a single WeakSet in toYAMLNode that was added to on entry and never unwound on exit, making it visit-once-ever rather than cycle detection. Eight variations were swept (union of 3, reversed union order, unmatched earlier schema, duplicate prior action, wildcard-then-union, nested update values) and the first match survived in every one — so no variation of the minimal example can corrupt both.

What does reproduce their exact output is an action that also matches a schema sitting earlier in the file than ActorType: the surviving copy lands on that earlier schema, leaving both pasted schemas as ? null. Their overlay's other CSDF actions would do exactly this, and the first match simply wasn't in the excerpt they pasted. This is confirmed on the real FDX spec above, where ActorType itself comes out as ? null pre-fix.

Their five real overlay files remain unobtainable — nothing was ever attached to the issue — but the mechanism is fully reproduced on real FDX data, so they are no longer needed to validate the fix.

Testing

tsc --noEmit clean; npm test 82 passing.

Closes #127

When a single overlay action updated more than one target, every
match after the first lost the updated members. In YAML output they
were serialized as an explicit key with no value (? null); in JSON
output they became null values, which is quieter but harder to
spot. A copy action whose source node sat later in the file lost
its own properties the same way.

Two upstream defects combined to cause this. apidom-overlay merged
the same update element instance into every matched target, and the
style-preserving serializers treated a shared element instance as
if it were a cycle, dropping every occurrence after the first.

Fixed by updating the apidom dependency family:

  @speclynx/apidom-core       ^5.0.1  -> ^5.1.1
  @speclynx/apidom-ls        ^2.11.6  -> ^2.11.7
  @speclynx/apidom-overlay     ^5.0.1 -> ^5.1.1
  @speclynx/apidom-reference   ^5.0.1 -> ^5.1.1

Refs speclynx/apidom#459
Refs speclynx/apidom#460
Closes #127
@char0n
char0n force-pushed the fix/127-update-apidom-packages branch from 2663261 to f96b0c4 Compare August 19, 2026 13:08
@char0n char0n changed the title fix(deps): update apidom packages to 5.1.1 fix(overlay): stop dropping members on multi-target actions Aug 19, 2026
@char0n
char0n merged commit b7c3825 into main Aug 19, 2026
9 checks passed
@char0n
char0n deleted the fix/127-update-apidom-packages branch August 19, 2026 13:12
char0n pushed a commit that referenced this pull request Aug 19, 2026
## [1.4.1](v1.4.0...v1.4.1) (2026-08-19)

### Bug Fixes

* **overlay:** stop dropping members on multi-target actions ([#128](#128)) ([b7c3825](b7c3825)), closes [speclynx/apidom#459](speclynx/apidom#459) [speclynx/apidom#460](speclynx/apidom#460) [#127](#127)
@char0n

char0n commented Aug 19, 2026

Copy link
Copy Markdown
Member Author

🎉 This PR is included in version 1.4.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overlay: JSONpath errors

1 participant