@@ -13,6 +13,7 @@ import { OpenAPIDisclosure } from './OpenAPIDisclosure';
1313import { OpenAPISchemaName } from './OpenAPISchemaName' ;
1414import type { OpenAPIClientContext } from './context' ;
1515import { retrocycle } from './decycle' ;
16+ import { getDisclosureLabel } from './getDisclosureLabel' ;
1617import { stringifyOpenAPI } from './stringifyOpenAPI' ;
1718import { tString } from './translate' ;
1819import { checkIsReference , resolveDescription , resolveFirstExample } from './utils' ;
@@ -606,6 +607,11 @@ function getSchemaTitle(schema: OpenAPIV3.SchemaObject): string {
606607 if ( schema . format ) {
607608 type += ` · ${ schema . format } ` ;
608609 }
610+
611+ // Only add the title if it's an object (no need for the title of a string, number, etc.)
612+ if ( type === 'object' && schema . title ) {
613+ type += ` · ${ schema . title . replaceAll ( ' ' , '' ) } ` ;
614+ }
609615 }
610616
611617 if ( 'anyOf' in schema ) {
@@ -620,25 +626,3 @@ function getSchemaTitle(schema: OpenAPIV3.SchemaObject): string {
620626
621627 return type ;
622628}
623-
624- function getDisclosureLabel ( props : {
625- schema : OpenAPIV3 . SchemaObject ;
626- isExpanded : boolean ;
627- context : OpenAPIClientContext ;
628- } ) {
629- const { schema, isExpanded, context } = props ;
630- let label : string ;
631- if ( schema . type === 'array' && ! ! schema . items ) {
632- if ( schema . items . oneOf ) {
633- label = tString ( context . translation , 'available_items' ) . toLowerCase ( ) ;
634- } else if ( schema . items . enum || schema . items . type === 'object' ) {
635- label = tString ( context . translation , 'properties' ) . toLowerCase ( ) ;
636- } else {
637- label = schema . items . title ?? schema . title ?? getSchemaTitle ( schema . items ) ;
638- }
639- } else {
640- label = schema . title || tString ( context . translation , 'properties' ) . toLowerCase ( ) ;
641- }
642-
643- return tString ( context . translation , isExpanded ? 'hide' : 'show' , label ) ;
644- }
0 commit comments