Skip to content

Commit 6c6071e

Browse files
committed
improve handling of top-level primitives
1 parent a7b9d3f commit 6c6071e

File tree

1 file changed

+25
-0
lines changed
  • packages/docusaurus-theme-openapi-docs/src/theme/Schema

1 file changed

+25
-0
lines changed

packages/docusaurus-theme-openapi-docs/src/theme/Schema/index.tsx

+25
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,31 @@ const SchemaNode: React.FC<SchemaProps> = ({ schema, schemaType }) => {
747747
);
748748
}
749749

750+
// Handle primitives
751+
if (
752+
schema.type &&
753+
!schema.oneOf &&
754+
!schema.anyOf &&
755+
!schema.properties &&
756+
!schema.allOf &&
757+
!schema.items &&
758+
!schema.additionalProperties
759+
) {
760+
const schemaName = getSchemaName(schema);
761+
return (
762+
<SchemaItem
763+
collapsible={false}
764+
name={schema.type}
765+
required={Boolean(schema.required)}
766+
schemaName={schemaName}
767+
qualifierMessage={getQualifierMessage(schema)}
768+
schema={schema}
769+
discriminator={false}
770+
children={null}
771+
/>
772+
);
773+
}
774+
750775
return (
751776
<div>
752777
{schema.oneOf && <AnyOneOf schema={schema} schemaType={schemaType} />}

0 commit comments

Comments
 (0)