1
1
import { isRegularNode , RegularNode } from '@stoplight/json-schema-tree' ;
2
2
import { Box , Flex , HStack , Icon , Menu , Pressable } from '@stoplight/mosaic' ;
3
3
import { useUpdateAtom } from 'jotai/utils' ;
4
+ import { isEmpty } from 'lodash' ;
4
5
import * as React from 'react' ;
5
6
6
7
import { COMBINER_NAME_MAP } from '../../consts' ;
7
8
import { useIsOnScreen } from '../../hooks/useIsOnScreen' ;
8
9
import { calculateChildrenToShow , isComplexArray } from '../../tree' ;
9
10
import { showPathCrumbsAtom } from '../PathCrumbs/state' ;
10
- import { Description } from '../shared' ;
11
+ import { Description , getValidationsFromSchema , Validations } from '../shared' ;
11
12
import { ChildStack } from '../shared/ChildStack' ;
12
13
import { Error } from '../shared/Error' ;
13
14
import { SchemaRow , SchemaRowProps } from './SchemaRow' ;
@@ -92,6 +93,7 @@ export const TopLevelSchemaRow = ({
92
93
}
93
94
94
95
if ( isComplexArray ( schemaNode ) && isPureObjectNode ( schemaNode . children [ 0 ] ) ) {
96
+ const validations = getValidationsFromSchema ( schemaNode ) ;
95
97
return (
96
98
< >
97
99
< ScrollCheck />
@@ -101,6 +103,12 @@ export const TopLevelSchemaRow = ({
101
103
array of:
102
104
</ Box >
103
105
106
+ { ! isEmpty ( validations ) && (
107
+ < Box fontSize = "sm" mb = { 1 } mt = { - 2 } >
108
+ < Validations validations = { isRegularNode ( schemaNode ) ? getValidationsFromSchema ( schemaNode ) : { } } />
109
+ </ Box >
110
+ ) }
111
+
104
112
{ childNodes . length > 0 ? (
105
113
< ChildStack
106
114
schemaNode = { schemaNode }
0 commit comments