1
+ {
2
+ "$schema" : " http://json-schema.org/draft-07/schema" ,
3
+ "title" : " Rules" ,
4
+ "description" : " A list of validation rules" ,
5
+ "type" : " array" ,
6
+ "items" : {
7
+ "type" : " object" ,
8
+ "properties" : {
9
+ "condition" : {
10
+ "description" : " The condition to be met for the rule to pass" ,
11
+ "type" : " object" ,
12
+ "properties" : {
13
+ "type" : {
14
+ "description" : " The type of the condition" ,
15
+ "enum" : [
16
+ " and" , " or" , " null" , " in" , " blank" , " regex" , " bytes" , " length" , " contains" , " range" , " true" ,
17
+ " !and" , " !or" , " !null" , " !in" , " !blank" , " !regex" , " !bytes" , " !length" , " !contains" , " !range" , " !true"
18
+ ]
19
+ },
20
+ "field" : {
21
+ "description" : " The field to be checked" ,
22
+ "type" : " string"
23
+ },
24
+ "arg" : {
25
+ "description" : " The argument of the condition" ,
26
+ "type" : " string"
27
+ },
28
+ "args" : {
29
+ "description" : " The arguments of the condition" ,
30
+ "type" : " array" ,
31
+ "items" : {
32
+ "type" : " string" ,
33
+ "minItems" : 1 ,
34
+ "uniqueItems" : true
35
+ }
36
+ },
37
+ "conditions" : {
38
+ "description" : " The sub-conditions of the condition" ,
39
+ "type" : " array" ,
40
+ "items" : {
41
+ "$ref" : " #/items/properties/condition"
42
+ }
43
+ }
44
+ },
45
+ "required" : [" type" ],
46
+ "anyOf" : [
47
+ {
48
+ "properties" : {
49
+ "type" : { "enum" : [
50
+ " regex" , " bytes" , " length" , " contains" , " range" ,
51
+ " !regex" , " !bytes" , " !length" , " !contains" , " !range"
52
+ ] }
53
+ },
54
+ "required" : [" arg" ]
55
+ },
56
+ {
57
+ "properties" : {
58
+ "type" : { "enum" : [" in" , " !in" ] }
59
+ },
60
+ "required" : [" args" ]
61
+ },
62
+ {
63
+ "properties" : {
64
+ "type" : { "enum" : [" and" , " or" , " !and" , " !or" ] }
65
+ },
66
+ "required" : [" conditions" ]
67
+ }
68
+ ],
69
+ "defaultSnippets" : [
70
+ { "label" : " Condition" , "body" : { "type" : " " } },
71
+ { "label" : " Condition with an argument" , "body" : { "type" : " " , "arg" : " " } },
72
+ { "label" : " Condition with multiple arguments" , "body" : { "type" : " " , "args" : [] } },
73
+ { "label" : " Condition with sub-conditions" , "body" : { "type" : " " , "conditions" : [{ "type" : " " }] } }
74
+ ]
75
+ },
76
+ "id" : {
77
+ "description" : " The unique identifier for the rule" ,
78
+ "type" : " integer"
79
+ },
80
+ "errorMessage" : {
81
+ "description" : " The error message to be returned if the rule fails" ,
82
+ "type" : " string"
83
+ }
84
+ },
85
+ "required" : [" condition" ]
86
+ }
87
+ }
0 commit comments