Skip to content

Commit

Permalink
Fix allOf schema qualifier and type (#766)
Browse files Browse the repository at this point in the history
* ensure merged schema is used to generate schema name and qualifier

* combine schema title and type when both are present

* cleanup formatting
  • Loading branch information
sserrata committed Mar 21, 2024
1 parent d7bbe20 commit 850b5d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,6 @@ function createEdges({
}: { mergedSchemas: SchemaObject; required: string[] | boolean } =
mergeAllOf(schema.allOf);
const mergedSchemaName = getSchemaName(mergedSchemas);

if (
mergedSchemas.oneOf !== undefined ||
mergedSchemas.anyOf !== undefined
Expand Down Expand Up @@ -685,8 +684,8 @@ function createEdges({
collapsible: false,
name,
required: Array.isArray(required) ? required.includes(name) : required,
schemaName: schemaName,
qualifierMessage: getQualifierMessage(schema),
schemaName: mergedSchemaName,
qualifierMessage: getQualifierMessage(mergedSchemas),
schema: mergedSchemas,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ function prettyName(schema: SchemaObject, circular?: boolean) {
// return schema.type;
}

if (schema.title && schema.type) {
return `${schema.title} (${schema.type})`;
}

return schema.title ?? schema.type;
}

Expand Down

0 comments on commit 850b5d0

Please sign in to comment.