diff --git a/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap b/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap index 2c76429342..2e689d7ae6 100644 --- a/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap +++ b/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap @@ -80,16 +80,12 @@ exports[`Components SchemaView discriminator should correctly render discriminat "options": "<<>>", "pattern": undefined, "rawSchema": Object { - "allOf": undefined, "default": undefined, - "parentRefs": Array [], "type": "string", }, "readOnly": false, "schema": Object { - "allOf": undefined, "default": undefined, - "parentRefs": Array [], "type": "string", }, "title": "", diff --git a/src/services/OpenAPIParser.ts b/src/services/OpenAPIParser.ts index d757598201..869e89c53f 100644 --- a/src/services/OpenAPIParser.ts +++ b/src/services/OpenAPIParser.ts @@ -192,6 +192,14 @@ export class OpenAPIParser { parentRefs: [], }; + // avoid mutating inner objects + if (receiver.properties !== undefined && typeof receiver.properties === 'object') { + receiver.properties = { ...receiver.properties }; + } + if (receiver.items !== undefined && typeof receiver.items === 'object') { + receiver.items = { ...receiver.items }; + } + const allOfSchemas = schema.allOf.map(subSchema => { const resolved = this.deref(subSchema, forceCircular); const subRef = subSchema.$ref || undefined;