11import { isRegularNode , RegularNode } from '@stoplight/json-schema-tree' ;
22import { Box , Flex , HStack , Icon , Menu , Pressable } from '@stoplight/mosaic' ;
33import { useUpdateAtom } from 'jotai/utils' ;
4+ import { isEmpty } from 'lodash' ;
45import * as React from 'react' ;
56
67import { COMBINER_NAME_MAP } from '../../consts' ;
78import { useIsOnScreen } from '../../hooks/useIsOnScreen' ;
89import { calculateChildrenToShow , isComplexArray } from '../../tree' ;
910import { showPathCrumbsAtom } from '../PathCrumbs/state' ;
10- import { Description } from '../shared' ;
11+ import { Description , getValidationsFromSchema , Validations } from '../shared' ;
1112import { ChildStack } from '../shared/ChildStack' ;
1213import { Error } from '../shared/Error' ;
1314import { SchemaRow , SchemaRowProps } from './SchemaRow' ;
@@ -92,6 +93,7 @@ export const TopLevelSchemaRow = ({
9293 }
9394
9495 if ( isComplexArray ( schemaNode ) && isPureObjectNode ( schemaNode . children [ 0 ] ) ) {
96+ const validations = getValidationsFromSchema ( schemaNode ) ;
9597 return (
9698 < >
9799 < ScrollCheck />
@@ -101,6 +103,12 @@ export const TopLevelSchemaRow = ({
101103 array of:
102104 </ Box >
103105
106+ { ! isEmpty ( validations ) && (
107+ < Box fontSize = "sm" mb = { 1 } mt = { - 2 } >
108+ < Validations validations = { isRegularNode ( schemaNode ) ? getValidationsFromSchema ( schemaNode ) : { } } />
109+ </ Box >
110+ ) }
111+
104112 { childNodes . length > 0 ? (
105113 < ChildStack
106114 schemaNode = { schemaNode }
0 commit comments