diff --git a/src/__tests__/__snapshots__/index.spec.tsx.snap b/src/__tests__/__snapshots__/index.spec.tsx.snap index af4f9e83..af09a013 100644 --- a/src/__tests__/__snapshots__/index.spec.tsx.snap +++ b/src/__tests__/__snapshots__/index.spec.tsx.snap @@ -331,8 +331,11 @@ exports[`HTML Output given anyOf combiner placed next to allOf given allOf mergi
- Admin -
+
+ Admin +
+
+
anyOf
@@ -439,8 +442,11 @@ exports[`HTML Output given array with oneOf containing items, should merge it co
- array[string] -
+
+ array[string] +
+
+
oneOf
@@ -544,8 +550,11 @@ exports[`HTML Output given oneOf combiner placed next to allOf given allOf mergi
- Admin -
+
+ Admin +
+
+
oneOf
@@ -1185,6 +1194,7 @@ exports[`HTML Output should match arrays/of-complex-objects.json 1`] = `
+
anyOf
@@ -1899,6 +1909,7 @@ exports[`HTML Output should match combiners/allOfs/complex.json 1`] = `
user
allOf +
allOf
@@ -1997,6 +2008,7 @@ exports[`HTML Output should match combiners/allOfs/complex.json 1`] = `
user
allOf +
allOf
@@ -2107,6 +2119,7 @@ exports[`HTML Output should match combiners/allOfs/complex.json 1`] = `
user
allOf +
allOf
@@ -2443,8 +2456,11 @@ exports[`HTML Output should match combiners/allOfs/with-type.json 1`] = `
- BugExample -
+
+ BugExample +
+
+
oneOf
@@ -2572,8 +2588,11 @@ exports[`HTML Output should match combiners/oneof-with-array-type.json 1`] = `
- array[object] -
+
+ array[object] +
+
+
oneOf
@@ -2627,8 +2646,10 @@ exports[`HTML Output should match combiners/oneof-within-array-item.json 1`] = `
- array[A] -
+
+ array[A] +
+
@@ -2869,6 +2890,7 @@ exports[`HTML Output should match default-schema.json 1`] = `
+
anyOf
diff --git a/src/components/SchemaRow/SchemaRow.tsx b/src/components/SchemaRow/SchemaRow.tsx index 587372d2..4cc74ec0 100644 --- a/src/components/SchemaRow/SchemaRow.tsx +++ b/src/components/SchemaRow/SchemaRow.tsx @@ -55,6 +55,7 @@ export const SchemaRow: React.FunctionComponent = ({ schemaNode, const isBrokenRef = typeof refNode?.error === 'string'; const childNodes = React.useMemo(() => calculateChildrenToShow(typeToShow), [typeToShow]); + const combiner = isRegularNode(schemaNode) && schemaNode.combiners?.length ? schemaNode.combiners[0] : null; return (
@@ -109,6 +110,8 @@ export const SchemaRow: React.FunctionComponent = ({ schemaNode, onChange={selectedIndex => setSelectedChoice(choices[selectedIndex as number])} /> )} + + {combiner !== null ?
{combiner}
: null}
= ({ schemaNode, nestin } if (isRegularNode(schemaNode) && choices.length > 1) { + const combiner = isRegularNode(schemaNode) && schemaNode.combiners?.length ? schemaNode.combiners[0] : null; + return (
@@ -37,11 +39,14 @@ export const TopLevelSchemaRow: React.FC = ({ schemaNode, nestin }))} renderTrigger={props => ( -
- {selectedChoice.title} -
- +
+
+ {selectedChoice.title} +
+ +
+ {combiner !== null ?
{combiner}
: null}
)}