@@ -39,53 +39,21 @@ function OpenAPISchemaProperty(props: {
39
39
40
40
const id = useId ( ) ;
41
41
42
- < < << << < HEAD
43
42
const circularRefId = parentCircularRefs . get ( schema ) ;
44
43
// Avoid recursing infinitely, and instead render a link to the parent schema
45
44
if ( circularRefId ) {
46
45
return < OpenAPISchemaCircularRef id = { circularRefId } schema = { schema } /> ;
47
46
}
48
- = === ===
49
- return (
50
- < div id = { id } className = { clsx ( 'openapi-schema' , className ) } >
51
- < OpenAPISchemaPresentation context = { context } property = { property } />
52
- { ( ( ) => {
53
- const circularRefId = parentCircularRefs . get ( schema ) ;
54
- // Avoid recursing infinitely, and instead render a link to the parent schema
55
- if ( circularRefId ) {
56
- return < OpenAPISchemaCircularRef id = { circularRefId } schema = { schema } /> ;
57
- }
58
- > >>> >>> main
59
47
60
48
const circularRefs = new Map ( parentCircularRefs ) ;
61
49
circularRefs . set ( schema , id ) ;
62
50
63
- < < << << < HEAD
64
51
const properties = getSchemaProperties ( schema ) ;
65
- = === ===
66
- const properties = getSchemaProperties ( schema ) ;
67
- if ( properties ?. length ) {
68
- return (
69
- < OpenAPIDisclosure
70
- icon = { context . icons . plus }
71
- label = { ( isExpanded ) =>
72
- getDisclosureLabel ( { schema, isExpanded, context } )
73
- }
74
- >
75
- < OpenAPISchemaProperties
76
- properties = { properties }
77
- circularRefs = { circularRefs }
78
- context = { context }
79
- />
80
- </ OpenAPIDisclosure >
81
- ) ;
82
- }
83
- > >>> >>> main
84
52
85
53
const ancestors = new Set ( circularRefs . keys ( ) ) ;
86
54
const alternatives = getSchemaAlternatives ( schema , ancestors ) ;
87
55
88
- const header = < OpenAPISchemaPresentation property = { property } /> ;
56
+ const header = < OpenAPISchemaPresentation context = { context } property = { property } /> ;
89
57
const content = ( ( ) => {
90
58
if ( properties ?. length ) {
91
59
return (
@@ -121,7 +89,7 @@ function OpenAPISchemaProperty(props: {
121
89
icon = { context . icons . plus }
122
90
className = { clsx ( 'openapi-schema' , className ) }
123
91
header = { header }
124
- label = { ( isExpanded ) => getDisclosureLabel ( schema , isExpanded ) }
92
+ label = { ( isExpanded ) => getDisclosureLabel ( { schema, isExpanded, context } ) }
125
93
>
126
94
{ content }
127
95
</ OpenAPIDisclosure >
@@ -253,12 +221,11 @@ function OpenAPISchemaAlternative(props: {
253
221
const { schema, circularRefs, context } = props ;
254
222
const properties = getSchemaProperties ( schema ) ;
255
223
256
- < < << << < HEAD
257
224
return properties ?. length ? (
258
225
< OpenAPIDisclosure
259
226
icon = { context . icons . plus }
260
- header = { < OpenAPISchemaPresentation property = { { schema } } /> }
261
- label = { ( isExpanded ) => getDisclosureLabel ( schema , isExpanded ) }
227
+ header = { < OpenAPISchemaPresentation property = { { schema } } context = { context } /> }
228
+ label = { ( isExpanded ) => getDisclosureLabel ( { schema, isExpanded, context } ) }
262
229
>
263
230
< OpenAPISchemaProperties
264
231
properties = { properties }
@@ -272,32 +239,6 @@ function OpenAPISchemaAlternative(props: {
272
239
circularRefs = { circularRefs }
273
240
context = { context }
274
241
/>
275
- =======
276
- return (
277
- < >
278
- { description ? (
279
- < Markdown source = { description } className = "openapi-schema-description" />
280
- ) : null }
281
- < OpenAPIDisclosure
282
- icon = { context . icons . plus }
283
- label = { ( isExpanded ) => getDisclosureLabel ( { schema, isExpanded, context } ) }
284
- >
285
- { properties ?. length ? (
286
- < OpenAPISchemaProperties
287
- properties = { properties }
288
- circularRefs = { circularRefs }
289
- context = { context }
290
- />
291
- ) : (
292
- < OpenAPISchemaProperty
293
- property = { { schema } }
294
- circularRefs = { circularRefs }
295
- context = { context }
296
- />
297
- ) }
298
- </ OpenAPIDisclosure >
299
- </ >
300
- >>> >>> > main
301
242
) ;
302
243
}
303
244
@@ -677,23 +618,13 @@ function getDisclosureLabel(props: {
677
618
if ( schema . type === 'array' && ! ! schema . items ) {
678
619
if ( schema . items . oneOf ) {
679
620
label = tString ( context . translation , 'available_items' ) . toLowerCase ( ) ;
680
- }
681
- // Fallback to "properties" for enums and objects
682
- else if ( schema . items . enum || schema . items . type === 'object' ) {
683
- < < << << < HEAD
684
- label = 'properties' ;
685
- === === =
686
- label = tString ( context . translation , 'child_attributes' ) . toLowerCase ( ) ;
687
- > >>> >>> main
621
+ } else if ( schema . items . enum || schema . items . type === 'object' ) {
622
+ label = tString ( context . translation , 'properties' ) . toLowerCase ( ) ;
688
623
} else {
689
624
label = schema . items . title ?? schema . title ?? getSchemaTitle ( schema . items ) ;
690
625
}
691
626
} else {
692
- < < << << < HEAD
693
- label = schema . title || 'properties' ;
694
- = === ===
695
- label = schema . title || tString ( context . translation , 'child_attributes' ) . toLowerCase ( ) ;
696
- > >>> >>> main
627
+ label = schema . title || tString ( context . translation , 'properties' ) . toLowerCase ( ) ;
697
628
}
698
629
699
630
return `${ isExpanded ? tString ( context . translation , 'hide' ) : tString ( context . translation , 'show' ) } ${ label } ` ;
0 commit comments