fix: incorrect detected schema title for deeply inherited schemas

This commit is contained in:
Roman Hotsiy 2019-05-12 21:38:00 +03:00
parent b0e660eca0
commit 7d7b4e3fb8
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 5 additions and 5 deletions

View File

@ -187,6 +187,7 @@ export class OpenAPIParser {
...schema, ...schema,
allOf: undefined, allOf: undefined,
parentRefs: [], parentRefs: [],
title: schema.title || (isNamedDefinition($ref) ? JsonPointer.baseName($ref) : undefined),
}; };
// avoid mutating inner objects // avoid mutating inner objects
@ -263,11 +264,6 @@ export class OpenAPIParser {
} }
} }
// name of definition or title on top level
if (schema.title === undefined && isNamedDefinition($ref)) {
receiver.title = JsonPointer.baseName($ref);
}
return receiver; return receiver;
} }

View File

@ -21,6 +21,7 @@ Object {
"type": "string", "type": "string",
}, },
}, },
"title": undefined,
}, },
Object { Object {
"allOf": undefined, "allOf": undefined,
@ -38,6 +39,7 @@ Object {
"type": "string", "type": "string",
}, },
}, },
"title": undefined,
}, },
], ],
}, },
@ -59,6 +61,7 @@ Object {
"type": "string", "type": "string",
}, },
}, },
"title": undefined,
}, },
Object { Object {
"allOf": undefined, "allOf": undefined,
@ -76,6 +79,7 @@ Object {
"type": "string", "type": "string",
}, },
}, },
"title": undefined,
}, },
], ],
}, },