diff --git a/src/__stories__/index.ts b/src/__stories__/index.ts index c524f209..97e5364f 100644 --- a/src/__stories__/index.ts +++ b/src/__stories__/index.ts @@ -1,2 +1,3 @@ // NOTE: The ordering of these imports determines the ordering in Storybook import './JsonSchemaViewer'; +import './SchemaRow'; diff --git a/src/components/SchemaRow/SchemaRow.tsx b/src/components/SchemaRow/SchemaRow.tsx index 4cc74ec0..5ad9748b 100644 --- a/src/components/SchemaRow/SchemaRow.tsx +++ b/src/components/SchemaRow/SchemaRow.tsx @@ -25,8 +25,6 @@ export interface SchemaRowProps { } export const SchemaRow: React.FunctionComponent = ({ schemaNode, nestingLevel }) => { - const description = isRegularNode(schemaNode) ? schemaNode.annotations.description : null; - const { defaultExpandedDepth, renderRowAddon, onGoToRef, hideExamples } = useJSVOptionsContext(); const [isExpanded, setExpanded] = React.useState( @@ -35,6 +33,7 @@ export const SchemaRow: React.FunctionComponent = ({ schemaNode, const { selectedChoice, setSelectedChoice, choices } = useChoices(schemaNode); const typeToShow = selectedChoice.type; + const description = isRegularNode(typeToShow) ? typeToShow.annotations.description : null; const refNode = React.useMemo(() => { if (isReferenceNode(schemaNode)) { @@ -119,7 +118,6 @@ export const SchemaRow: React.FunctionComponent = ({ schemaNode, validations={isRegularNode(schemaNode) ? schemaNode.validations : {}} /> - {typeof description === 'string' && description.length > 0 && (