diff --git a/.changeset/dull-kiwis-agree.md b/.changeset/dull-kiwis-agree.md new file mode 100644 index 0000000000..9bb85d0daa --- /dev/null +++ b/.changeset/dull-kiwis-agree.md @@ -0,0 +1,6 @@ +--- +"@redocly/openapi-core": patch +"@redocly/cli": patch +--- + +Fixed an issue with the `remove-x-internal` decorator where bundling API descirptions containing discriminators could fail when using **Node.js** v17 or earlier. diff --git a/packages/core/src/decorators/common/remove-x-internal.ts b/packages/core/src/decorators/common/remove-x-internal.ts index 06d72d09a9..8b34dc01e4 100644 --- a/packages/core/src/decorators/common/remove-x-internal.ts +++ b/packages/core/src/decorators/common/remove-x-internal.ts @@ -65,7 +65,7 @@ export const RemoveXInternal: Oas3Decorator | Oas2Decorator = ({ return { DiscriminatorMapping: { enter: (mapping: Record) => { - originalMapping = structuredClone(mapping); + originalMapping = JSON.parse(JSON.stringify(mapping)); }, }, any: {