fix: merge inner properties of allOf

This commit is contained in:
Roman Hotsiy 2018-03-05 13:47:04 +02:00
parent 2462639f76
commit 8926dd457c
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 16 additions and 5 deletions

View File

@ -76,12 +76,16 @@ exports[`Components SchemaView discriminator should correctly render discriminat
"options": "<<<filtered>>>", "options": "<<<filtered>>>",
"pattern": undefined, "pattern": undefined,
"rawSchema": Object { "rawSchema": Object {
"allOf": undefined,
"default": undefined, "default": undefined,
"parentRefs": Array [],
"type": "string", "type": "string",
}, },
"readOnly": false, "readOnly": false,
"schema": Object { "schema": Object {
"allOf": undefined,
"default": undefined, "default": undefined,
"parentRefs": Array [],
"type": "string", "type": "string",
}, },
"title": "", "title": "",

View File

@ -212,11 +212,18 @@ export class OpenAPIParser {
} }
if (subSchema.properties !== undefined) { if (subSchema.properties !== undefined) {
// TODO: merge properties contents receiver.properties = receiver.properties || {};
receiver.properties = { for (let prop in subSchema.properties) {
...(receiver.properties || {}), if (!receiver.properties[prop]) {
...subSchema.properties, 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) { if (subSchema.required !== undefined) {