11import { JsonSchema7 } from '@jsonforms/core' ;
2+
23export const uiMetaSchema : JsonSchema7 = {
4+ '$schema' : 'http://json-schema.org/draft-07/schema' ,
35 'type' : 'object' ,
46 '$id' : '#root' ,
57 'properties' : {
@@ -71,10 +73,23 @@ export const uiMetaSchema: JsonSchema7 = {
7173 '$ref' : '#/definitions/rule'
7274 }
7375 } ,
74- 'required' : [
75- 'type' ,
76- 'scope'
77- ]
76+ 'required' : [ 'type' , 'scope' ] ,
77+ 'additionalProperties' : false ,
78+ 'errorMessage' : {
79+ 'properties' : {
80+ 'type' : 'type should be equal to one of the allowed values' ,
81+ 'scope' : 'Control scope should match pattern "^#\\/properties\\/{1}"' ,
82+ 'suggestion' : 'Control suggestion should be array' ,
83+ 'options' : 'Control options should be object' ,
84+ 'label' : 'Control label should be string,boolean or label object'
85+ } ,
86+ 'required' : {
87+ 'scope' : 'Control should have an object property "scope"' ,
88+ 'type' : 'Control should have an object property "type"'
89+ } ,
90+ 'additionalProperties' : 'Control should not have properties ' +
91+ 'other than type,label,scope,options,suggestion and rule'
92+ }
7893 } ,
7994 'horizontallayout' : {
8095 'type' : 'object' ,
@@ -92,10 +107,18 @@ export const uiMetaSchema: JsonSchema7 = {
92107 '$ref' : '#/definitions/rule'
93108 }
94109 } ,
95- 'required' : [
96- 'type' ,
97- 'elements'
98- ]
110+ 'required' : [ 'type' , 'elements' ] ,
111+ 'additionalProperties' : false ,
112+ 'errorMessage' : {
113+ 'properties' : {
114+ 'type' : 'type should be equal to one of the allowed values'
115+ } ,
116+ 'required' : {
117+ 'elements' : 'Layout should have an array property "elements"' ,
118+ 'type' : 'Layout should have a string property "type"'
119+ } ,
120+ 'additionalProperties' : 'Layout should not have properties other than type and elements'
121+ }
99122 } ,
100123 'verticallayout' : {
101124 'type' : 'object' ,
@@ -137,7 +160,19 @@ export const uiMetaSchema: JsonSchema7 = {
137160 'required' : [
138161 'type' ,
139162 'elements'
140- ]
163+ ] ,
164+ 'additionalProperties' : false ,
165+ 'errorMessage' : {
166+ 'properties' : {
167+ 'type' : 'type should be equal to one of the allowed values'
168+ } ,
169+ 'required' : {
170+ 'elements' : 'Categorization should have an array property "elements"' ,
171+ 'type' : 'Categorization should have a string property "type"'
172+ } ,
173+ 'additionalProperties' : 'Categorization should not have properties ' +
174+ 'other than type and elements'
175+ }
141176 } ,
142177 'category' : {
143178 'type' : 'object' ,
@@ -158,10 +193,19 @@ export const uiMetaSchema: JsonSchema7 = {
158193 '$ref' : '#/definitions/rule'
159194 }
160195 } ,
161- 'required' : [
162- 'type' ,
163- 'elements'
164- ]
196+ 'additionalProperties' : false ,
197+ 'errorMessage' : {
198+ 'properties' : {
199+ 'type' : 'type should be equal to one of the allowed values' ,
200+ 'label' : 'Category label should be string'
201+ } ,
202+ 'required' : {
203+ 'type' : 'Category layout should have a string property "type"' ,
204+ 'elements' : 'Category layout should have an array property "elements"'
205+ } ,
206+ 'additionalProperties' : 'Category layout should not have properties ' +
207+ 'other than type,elements and label'
208+ }
165209 } ,
166210 'group' : {
167211 'type' : 'object' ,
@@ -179,11 +223,21 @@ export const uiMetaSchema: JsonSchema7 = {
179223 'type' : 'string'
180224 }
181225 } ,
182- 'required' : [
183- 'type' ,
184- 'elements' ,
185- 'label'
186- ]
226+ 'required' : [ 'type' , 'elements' , 'label' ] ,
227+ 'additionalProperties' : false ,
228+ 'errorMessage' : {
229+ 'properties' : {
230+ 'type' : 'type should be equal to one of the allowed values' ,
231+ 'label' : 'Group label should be string'
232+ } ,
233+ 'required' : {
234+ 'type' : 'Group layout should have a string property "type"' ,
235+ 'elements' : 'Group layout should have an array property "elements"' ,
236+ 'label' : 'Group layout should have a string property "label"'
237+ } ,
238+ 'additionalProperties' : 'Group layout should not have properties ' +
239+ 'other than type,elements and label'
240+ }
187241 } ,
188242 'rule' : {
189243 'type' : 'object' ,
@@ -225,9 +279,15 @@ export const uiMetaSchema: JsonSchema7 = {
225279 ]
226280 }
227281 } ,
228- 'dependencies' : {
229- 'effect' : [ 'condition' ] ,
230- 'condition' : [ 'effect' ]
282+ 'required' : [
283+ 'effect' ,
284+ 'condition'
285+ ] ,
286+ 'errorMessage' : {
287+ 'required' : {
288+ 'effect' : 'Effect has to de defined' ,
289+ 'condition' : 'Condition has to be defined' ,
290+ }
231291 }
232292 } ,
233293 'scope' : {
@@ -244,5 +304,18 @@ export const uiMetaSchema: JsonSchema7 = {
244304 'required' : [
245305 'elements' ,
246306 'type'
247- ]
307+ ] ,
308+ 'additionalProperties' : false ,
309+ 'errorMessage' : {
310+ 'properties' : {
311+ 'type' : 'Root type should be equal to one of the allowed values' ,
312+ 'label' : 'Root label should be string'
313+ } ,
314+ 'required' : {
315+ 'elements' : 'Root should have an array property "elements"' ,
316+ 'type' : 'Root should have an object property "type"'
317+ } ,
318+ 'additionalProperties' : 'Root should not have properties ' +
319+ 'other than type,elements,label and rule'
320+ }
248321} ;
0 commit comments