From bb7ea85119013e42e4546c6556bce4786d6a89d2 Mon Sep 17 00:00:00 2001 From: Andrew Tatomyr Date: Mon, 4 Nov 2024 13:59:10 +0200 Subject: [PATCH] chore: fix the remove-x-internal decorator for Node.js v17- (#1793) --- .changeset/dull-kiwis-agree.md | 6 ++++++ packages/core/src/decorators/common/remove-x-internal.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/dull-kiwis-agree.md 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: {