Skip to content

Commit

Permalink
fix: different output of cli bundle and redoc
Browse files Browse the repository at this point in the history
fixes #547
  • Loading branch information
RomanHotsiy committed Jul 18, 2018
1 parent dcca44a commit 89aa754
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,12 @@ exports[`Components SchemaView discriminator should correctly render discriminat
"options": "<<<filtered>>>",
"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": "",
Expand Down
8 changes: 8 additions & 0 deletions src/services/OpenAPIParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 89aa754

Please sign in to comment.