@@ -10,6 +10,7 @@ import { COMBINER_NAME_MAP } from '../../consts';
1010import { useJSVOptionsContext } from '../../contexts' ;
1111import { getNodeId , getOriginalNodeId } from '../../hash' ;
1212import { isPropertyRequired , visibleChildren } from '../../tree' ;
13+ import { extractVendorExtensions } from '../../utils/extractVendorExtensions' ;
1314import { Caret , Description , getValidationsFromSchema , Types , Validations } from '../shared' ;
1415import { ChildStack } from '../shared/ChildStack' ;
1516import { Error } from '../shared/Error' ;
@@ -30,6 +31,7 @@ export const SchemaRow: React.FunctionComponent<SchemaRowProps> = React.memo(
3031 const {
3132 defaultExpandedDepth,
3233 renderRowAddon,
34+ renderExtensionAddon,
3335 onGoToRef,
3436 hideExamples,
3537 renderRootTreeLines,
@@ -65,6 +67,12 @@ export const SchemaRow: React.FunctionComponent<SchemaRowProps> = React.memo(
6567 const validations = isRegularNode ( schemaNode ) ? schemaNode . validations : { } ;
6668 const hasProperties = useHasProperties ( { required, deprecated, validations } ) ;
6769
70+ const [ totalVendorExtensions , vendorExtensions ] = React . useMemo (
71+ ( ) => extractVendorExtensions ( schemaNode . fragment ) ,
72+ [ schemaNode . fragment ] ,
73+ ) ;
74+ const hasVendorProperties = totalVendorExtensions > 0 ;
75+
6876 const annotationRootOffset = renderRootTreeLines ? 0 : 8 ;
6977 let annotationLeftOffset = - 20 - annotationRootOffset ;
7078 if ( nestingLevel > 1 ) {
@@ -100,11 +108,9 @@ export const SchemaRow: React.FunctionComponent<SchemaRowProps> = React.memo(
100108 } }
101109 >
102110 { ! isRootLevel && < Box borderT w = { isCollapsible ? 1 : 3 } ml = { - 3 } mr = { 3 } mt = { 2 } /> }
103-
104111 { parentChangeType !== 'added' && parentChangeType !== 'removed' ? (
105112 < NodeAnnotation change = { hasChanged } style = { { left : annotationLeftOffset } } />
106113 ) : null }
107-
108114 < VStack spacing = { 1 } maxW = "full" flex = { 1 } ml = { isCollapsible && ! isRootLevel ? 2 : undefined } >
109115 < Flex
110116 alignItems = "center"
@@ -113,7 +119,6 @@ export const SchemaRow: React.FunctionComponent<SchemaRowProps> = React.memo(
113119 cursor = { isCollapsible ? 'pointer' : undefined }
114120 >
115121 { isCollapsible ? < Caret isExpanded = { isExpanded } /> : null }
116-
117122 < Flex alignItems = "baseline" fontSize = "base" >
118123 { schemaNode . subpath . length > 0 && shouldShowPropertyName ( schemaNode ) && (
119124 < Box
@@ -167,22 +172,19 @@ export const SchemaRow: React.FunctionComponent<SchemaRowProps> = React.memo(
167172 />
168173 ) }
169174 </ Flex >
170-
171175 { hasProperties && < Divider atom = { isNodeHoveredAtom ( schemaNode ) } /> }
172-
173176 < Properties required = { required } deprecated = { deprecated } validations = { validations } />
174177 </ Flex >
175-
176178 { typeof description === 'string' && description . length > 0 && < Description value = { description } /> }
177-
178179 < Validations
179180 validations = { isRegularNode ( schemaNode ) ? getValidationsFromSchema ( schemaNode ) : { } }
180181 hideExamples = { hideExamples }
181182 />
183+ { hasVendorProperties && renderExtensionAddon ? (
184+ < Box > { renderExtensionAddon ( { schemaNode, nestingLevel, vendorExtensions } ) } </ Box >
185+ ) : null }
182186 </ VStack >
183-
184187 < Error schemaNode = { schemaNode } />
185-
186188 { renderRowAddon ? < Box > { renderRowAddon ( { schemaNode, nestingLevel } ) } </ Box > : null }
187189 </ Flex >
188190 { isCollapsible && isExpanded ? (
0 commit comments