fix: hoist and combine allOf subschema titles

This commit is contained in:
Drahflow 2022-05-03 16:06:50 +02:00
parent 60bc603e9b
commit 7ee9d7f4f3
No known key found for this signature in database
GPG Key ID: 5F9DBFC9AD22AD75

View File

@ -269,6 +269,7 @@ export class OpenAPIParser {
schema: MergedOpenAPISchema; schema: MergedOpenAPISchema;
}>; }>;
const subSchemaTitles: string[] = [];
for (const { $ref: subSchemaRef, schema: subSchema } of allOfSchemas) { for (const { $ref: subSchemaRef, schema: subSchema } of allOfSchemas) {
if ( if (
receiver.type !== subSchema.type && receiver.type !== subSchema.type &&
@ -326,6 +327,14 @@ export class OpenAPIParser {
// receiver.title = JsonPointer.baseName(subSchemaRef); // receiver.title = JsonPointer.baseName(subSchemaRef);
} }
} }
if (subSchema.title !== undefined) {
subSchemaTitles.push(subSchema.title);
}
}
if (receiver.title === undefined && subSchemaTitles.length) {
receiver.title = subSchemaTitles.join('+');
} }
return receiver; return receiver;