@@ -80,8 +80,80 @@ const renderSchema = (
8080 if ( schemaItem ?. schema ?. $ref ) return resolveRef ( schemaItem . schema . $ref , schemaItem )
8181 if ( schemaItem ?. $ref ) return resolveRef ( schemaItem . $ref , schemaItem )
8282
83+ const renderCombinations = ( item , itemName , type ) => (
84+ < div >
85+ < SchemaProperty
86+ title = { itemName || item . title }
87+ type = { type }
88+ required = { schemaItem . required || ! ! item . required }
89+ description = { item . description || item . title || '' }
90+ pattern = { item . pattern }
91+ defaultVal = { item . default }
92+ showRequired = { showRequired }
93+ />
94+ < div className = "padding-bottom--md" >
95+ < CollapseBox isInitExpanded = { false } >
96+ { item [ type ] . map ( ( option , index ) => (
97+ < div key = { `${ index } ` } className = { styles . paramItemWrapper } >
98+ { renderSchema ( option , schemas , option . title , showRequired , isExpandedByDefault ) }
99+ </ div >
100+ ) ) }
101+ </ CollapseBox >
102+ </ div >
103+ </ div >
104+ )
105+
83106 const renderObject = ( item , itemName ) => {
84107 const requiredFields = Array . isArray ( item . required ) ? item . required : [ ]
108+ const elements = [ ]
109+
110+ // First render direct properties
111+ if ( item . properties ) {
112+ Object . entries ( item . properties ) . forEach ( ( [ key , value ] : [ string , SchemaPropertyType ] ) => {
113+ elements . push (
114+ < div key = { key } className = { styles . paramItemWrapper } >
115+ { renderSchema (
116+ {
117+ ...value ,
118+ required : requiredFields . includes ( key ) ,
119+ } ,
120+ schemas ,
121+ key ,
122+ showRequired ,
123+ isExpandedByDefault
124+ ) }
125+ </ div >
126+ )
127+ } )
128+ }
129+
130+ // Then render combination schemas (oneOf/anyOf/allOf) within the same object
131+ if ( item . oneOf ) {
132+ elements . push (
133+ < div key = "oneOf-variations" className = { styles . paramItemWrapper } >
134+ < h6 className = "type-paragraph-s font-primary font-weight-medium" > Transaction Types:</ h6 >
135+ { renderCombinations ( item , 'Transaction Types' , 'oneOf' ) }
136+ </ div >
137+ )
138+ }
139+
140+ if ( item . anyOf ) {
141+ elements . push (
142+ < div key = "anyOf-variations" className = { styles . paramItemWrapper } >
143+ < h6 className = "type-paragraph-s font-primary font-weight-medium" > Transaction Types:</ h6 >
144+ { renderCombinations ( item , 'Transaction Types' , 'anyOf' ) }
145+ </ div >
146+ )
147+ }
148+
149+ if ( item . allOf ) {
150+ elements . push (
151+ < div key = "allOf-variations" className = { styles . paramItemWrapper } >
152+ { renderCombinations ( item , 'Combined Types' , 'allOf' ) }
153+ </ div >
154+ )
155+ }
156+
85157 return (
86158 < div >
87159 < SchemaProperty
@@ -95,22 +167,7 @@ const renderSchema = (
95167 />
96168 < div className = "padding-bottom--md" >
97169 < CollapseBox isInitExpanded = { isExpandedByDefault } >
98- < >
99- { Object . entries ( item . properties ) . map ( ( [ key , value ] : [ string , SchemaPropertyType ] ) => (
100- < div key = { key } className = { styles . paramItemWrapper } >
101- { renderSchema (
102- {
103- ...value ,
104- required : requiredFields . includes ( key ) ,
105- } ,
106- schemas ,
107- key ,
108- showRequired ,
109- isExpandedByDefault
110- ) }
111- </ div >
112- ) ) }
113- </ >
170+ < > { elements } </ >
114171 </ CollapseBox >
115172 </ div >
116173 </ div >
@@ -150,29 +207,6 @@ const renderSchema = (
150207 return null
151208 }
152209
153- const renderCombinations = ( item , itemName , type ) => (
154- < div >
155- < SchemaProperty
156- title = { itemName || item . title }
157- type = { type }
158- required = { schemaItem . required || ! ! item . required }
159- description = { item . description || item . title || '' }
160- pattern = { item . pattern }
161- defaultVal = { item . default }
162- showRequired = { showRequired }
163- />
164- < div className = "padding-bottom--md" >
165- < CollapseBox isInitExpanded = { false } >
166- { item [ type ] . map ( ( option , index ) => (
167- < div key = { `${ index } ` } className = { styles . paramItemWrapper } >
168- { renderSchema ( option , schemas , option . title , showRequired , isExpandedByDefault ) }
169- </ div >
170- ) ) }
171- </ CollapseBox >
172- </ div >
173- </ div >
174- )
175-
176210 const renderArray = ( item , itemName ) => {
177211 const arrayType = getArrayTypeDescription ( item . items , schemas )
178212
0 commit comments