diff --git a/src/components/Schema/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap b/src/components/Schema/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap index b54d4f3eff..0daf93a6a1 100644 --- a/src/components/Schema/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap +++ b/src/components/Schema/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap @@ -76,12 +76,16 @@ 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 618bc1ee11..3bad8a5ae1 100644 --- a/src/services/OpenAPIParser.ts +++ b/src/services/OpenAPIParser.ts @@ -212,11 +212,18 @@ export class OpenAPIParser { } if (subSchema.properties !== undefined) { - // TODO: merge properties contents - receiver.properties = { - ...(receiver.properties || {}), - ...subSchema.properties, - }; + receiver.properties = receiver.properties || {}; + for (let prop in subSchema.properties) { + if (!receiver.properties[prop]) { + receiver.properties[prop] = subSchema.properties[prop]; + } else { + // merge inner properties + receiver.properties[prop] = this.mergeAllOf( + { allOf: [receiver.properties[prop], subSchema.properties[prop]] }, + $ref + '/properties/' + prop, + ); + } + } } if (subSchema.required !== undefined) {