@@ -841,6 +841,25 @@ const SchemaEdge: React.FC<SchemaEdgeProps> = ({
841
841
) ;
842
842
} ;
843
843
844
+ function renderChildren (
845
+ schema : SchemaObject ,
846
+ schemaType : "request" | "response"
847
+ ) {
848
+ return (
849
+ < >
850
+ { schema . oneOf && < AnyOneOf schema = { schema } schemaType = { schemaType } /> }
851
+ { schema . anyOf && < AnyOneOf schema = { schema } schemaType = { schemaType } /> }
852
+ { schema . properties && (
853
+ < Properties schema = { schema } schemaType = { schemaType } />
854
+ ) }
855
+ { schema . additionalProperties && (
856
+ < AdditionalProperties schema = { schema } schemaType = { schemaType } />
857
+ ) }
858
+ { schema . items && < Items schema = { schema } schemaType = { schemaType } /> }
859
+ </ >
860
+ ) ;
861
+ }
862
+
844
863
const SchemaNode : React . FC < SchemaProps > = ( { schema, schemaType } ) => {
845
864
if (
846
865
( schemaType === "request" && schema . readOnly ) ||
@@ -889,10 +908,6 @@ const SchemaNode: React.FC<SchemaProps> = ({ schema, schemaType }) => {
889
908
) ;
890
909
}
891
910
892
- if ( schema . oneOf || schema . anyOf ) {
893
- return < AnyOneOf schema = { schema } schemaType = { schemaType } /> ;
894
- }
895
-
896
911
// Handle primitives
897
912
if (
898
913
schema . type &&
@@ -918,19 +933,7 @@ const SchemaNode: React.FC<SchemaProps> = ({ schema, schemaType }) => {
918
933
) ;
919
934
}
920
935
921
- return (
922
- < div >
923
- { schema . oneOf && < AnyOneOf schema = { schema } schemaType = { schemaType } /> }
924
- { schema . anyOf && < AnyOneOf schema = { schema } schemaType = { schemaType } /> }
925
- { schema . properties && (
926
- < Properties schema = { schema } schemaType = { schemaType } />
927
- ) }
928
- { schema . additionalProperties && (
929
- < AdditionalProperties schema = { schema } schemaType = { schemaType } />
930
- ) }
931
- { schema . items && < Items schema = { schema } schemaType = { schemaType } /> }
932
- </ div >
933
- ) ;
936
+ return renderChildren ( schema , schemaType ) ;
934
937
} ;
935
938
936
939
export default SchemaNode ;
0 commit comments