diff --git a/packages/docusaurus-theme-openapi-docs/src/theme/Schema/index.tsx b/packages/docusaurus-theme-openapi-docs/src/theme/Schema/index.tsx index 06a84a3e2..0cea89ab5 100644 --- a/packages/docusaurus-theme-openapi-docs/src/theme/Schema/index.tsx +++ b/packages/docusaurus-theme-openapi-docs/src/theme/Schema/index.tsx @@ -522,14 +522,19 @@ const Edge = ({ name, schema, required, discriminator, schemaType }: any) => { ); } - if ( - schema.oneOf || - schema.anyOf || - schema.properties || - schema.additionalProperties || - (schema.items && - (schema.items.properties || schema.items.anyOf || schema.items.oneOf)) - ) { + if (schema.oneOf || schema.anyOf) { + return ; + } + + if (schema.properties) { + return ; + } + + if (schema.additionalProperties) { + return ; + } + + if (schema.items?.properties) { return ( { ); } + if (schema.items?.anyOf || schema.items?.oneOf) { + return ( + + ); + } + + if (schema.allOf) { + const { mergedSchemas }: { mergedSchemas: SchemaObject } = mergeAllOf( + schema.allOf + ); + + if ( + (schemaType === "request" && mergedSchemas.readOnly) || + (schemaType === "response" && mergedSchemas.writeOnly) + ) { + return null; + } + + const mergedSchemaName = getSchemaName(mergedSchemas); + + if (mergedSchemas.oneOf || mergedSchemas.anyOf) { + return ( + + ); + } + + if (mergedSchemas.properties !== undefined) { + return ( + + ); + } + + if (mergedSchemas.items?.properties) { + ; + } + + return ( + + ); + } + return (