@@ -16,8 +16,12 @@ export function OpenAPISchemas(props: {
16
16
className ?: string ;
17
17
data : OpenAPISchemasData ;
18
18
context : OpenAPISchemasContextProps ;
19
+ /**
20
+ * Whether to show the schema directly if there is only one.
21
+ */
22
+ grouped ?: boolean ;
19
23
} ) {
20
- const { className, data, context } = props ;
24
+ const { className, data, context, grouped } = props ;
21
25
const { schemas } = data ;
22
26
23
27
const clientContext : OpenAPIClientContext = {
@@ -32,7 +36,7 @@ export function OpenAPISchemas(props: {
32
36
33
37
return (
34
38
< div className = { clsx ( 'openapi-schemas' , className ) } >
35
- < OpenAPIRootSchemasSchema schemas = { schemas } context = { clientContext } />
39
+ < OpenAPIRootSchemasSchema grouped = { grouped } schemas = { schemas } context = { clientContext } />
36
40
</ div >
37
41
) ;
38
42
}
@@ -44,11 +48,12 @@ export function OpenAPISchemas(props: {
44
48
function OpenAPIRootSchemasSchema ( props : {
45
49
schemas : OpenAPISchemasData [ 'schemas' ] ;
46
50
context : OpenAPIClientContext ;
51
+ grouped ?: boolean ;
47
52
} ) {
48
- const { schemas, context } = props ;
53
+ const { schemas, context, grouped } = props ;
49
54
50
- // If there is only one model, we show it directly.
51
- if ( schemas . length === 1 ) {
55
+ // If there is only one model and we are not grouping , we show it directly.
56
+ if ( schemas . length === 1 && ! grouped ) {
52
57
const schema = schemas ?. [ 0 ] ?. schema ;
53
58
54
59
if ( ! schema ) {
0 commit comments