Skip to content

Commit 0ea66e2

Browse files
fix: Handling description for Combiners-STOP-95 (#289)
* fix: description for Combiners(allOf,anyOf,oneOf) * fix: handling description for Combiners * fix: have removed export keyword before function
1 parent 230134c commit 0ea66e2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/components/SchemaRow/SchemaRow.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ export const SchemaRow: React.FunctionComponent<SchemaRowProps> = React.memo(
175175
{hasProperties && <Divider atom={isNodeHoveredAtom(schemaNode)} />}
176176
<Properties required={required} deprecated={deprecated} validations={validations} />
177177
</Flex>
178-
{typeof description === 'string' && description.length > 0 && <Description value={description} />}
178+
{typeof description === 'string' &&
179+
(!combiner || schemaNode.parent?.fragment.description !== description) &&
180+
description.length > 0 && <Description value={description} />}
179181
<Validations
180182
validations={isRegularNode(schemaNode) ? getValidationsFromSchema(schemaNode) : {}}
181183
hideExamples={hideExamples}

src/components/SchemaRow/TopLevelSchemaRow.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ export const TopLevelSchemaRow = ({
6666
return (
6767
<>
6868
<ScrollCheck />
69-
<Description value={schemaNode.annotations.description} />
69+
{schemaNode.annotations.description !== schemaNode.parent?.fragment.description && (
70+
<Description value={schemaNode.annotations.description} />
71+
)}
7072
<HStack spacing={3} pb={4}>
7173
<Menu
7274
aria-label="Pick a type"

0 commit comments

Comments
 (0)