@sanity/validation 3.0.0-dev-preview.11 → 3.0.0-dev-preview.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/dts/src/validateDocument.test.js +2 -1
- package/lib/dts/src/validateDocument.test.js.map +1 -1
- package/lib/dts/test/__snapshots__/array.test.js.snap +336 -0
- package/lib/dts/test/__snapshots__/children.test.js.snap +253 -0
- package/lib/dts/test/__snapshots__/generics.test.js.snap +91 -0
- package/lib/dts/test/__snapshots__/numbers.test.js.snap +207 -0
- package/lib/dts/test/__snapshots__/strings.test.js.snap +406 -0
- package/lib/dts/tsconfig.lib.tsbuildinfo +1 -1
- package/lib/dts/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -13
- package/src/validateDocument.test.ts +2 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`generics can customize error messages 1`] = `
|
|
4
|
+
Array [
|
|
5
|
+
Object {
|
|
6
|
+
"item": ValidationError {
|
|
7
|
+
"children": undefined,
|
|
8
|
+
"message": "Dude it needs to be a string",
|
|
9
|
+
"operation": undefined,
|
|
10
|
+
"paths": Array [],
|
|
11
|
+
},
|
|
12
|
+
"level": "error",
|
|
13
|
+
"path": Array [],
|
|
14
|
+
},
|
|
15
|
+
]
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
exports[`generics can customize info messages 1`] = `
|
|
19
|
+
Array [
|
|
20
|
+
Object {
|
|
21
|
+
"item": ValidationError {
|
|
22
|
+
"children": undefined,
|
|
23
|
+
"message": "Dude it should probably be a string",
|
|
24
|
+
"operation": undefined,
|
|
25
|
+
"paths": Array [],
|
|
26
|
+
},
|
|
27
|
+
"level": "info",
|
|
28
|
+
"path": Array [],
|
|
29
|
+
},
|
|
30
|
+
]
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
exports[`generics can customize warning messages 1`] = `
|
|
34
|
+
Array [
|
|
35
|
+
Object {
|
|
36
|
+
"item": ValidationError {
|
|
37
|
+
"children": undefined,
|
|
38
|
+
"message": "Dude it should probably be a string",
|
|
39
|
+
"operation": undefined,
|
|
40
|
+
"paths": Array [],
|
|
41
|
+
},
|
|
42
|
+
"level": "warning",
|
|
43
|
+
"path": Array [],
|
|
44
|
+
},
|
|
45
|
+
]
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
exports[`generics can demote errors to warnings 1`] = `
|
|
49
|
+
Array [
|
|
50
|
+
Object {
|
|
51
|
+
"item": ValidationError {
|
|
52
|
+
"children": undefined,
|
|
53
|
+
"message": "Expected type \\"String\\", got \\"Number\\"",
|
|
54
|
+
"operation": undefined,
|
|
55
|
+
"paths": Array [],
|
|
56
|
+
},
|
|
57
|
+
"level": "warning",
|
|
58
|
+
"path": Array [],
|
|
59
|
+
},
|
|
60
|
+
]
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
exports[`generics can merge rules 1`] = `
|
|
64
|
+
Array [
|
|
65
|
+
Object {
|
|
66
|
+
"item": ValidationError {
|
|
67
|
+
"children": undefined,
|
|
68
|
+
"message": "Must be at least 5 characters long",
|
|
69
|
+
"operation": undefined,
|
|
70
|
+
"paths": Array [],
|
|
71
|
+
},
|
|
72
|
+
"level": "error",
|
|
73
|
+
"path": Array [],
|
|
74
|
+
},
|
|
75
|
+
]
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
exports[`generics returns arrays of errors/warnings by default 1`] = `
|
|
79
|
+
Array [
|
|
80
|
+
Object {
|
|
81
|
+
"item": ValidationError {
|
|
82
|
+
"children": undefined,
|
|
83
|
+
"message": "Expected type \\"String\\", got \\"Number\\"",
|
|
84
|
+
"operation": undefined,
|
|
85
|
+
"paths": Array [],
|
|
86
|
+
},
|
|
87
|
+
"level": "error",
|
|
88
|
+
"path": Array [],
|
|
89
|
+
},
|
|
90
|
+
]
|
|
91
|
+
`;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`number greater than constraint: gt: too low 1`] = `
|
|
4
|
+
Array [
|
|
5
|
+
Object {
|
|
6
|
+
"item": ValidationError {
|
|
7
|
+
"children": undefined,
|
|
8
|
+
"message": "Must be greater than 10",
|
|
9
|
+
"operation": undefined,
|
|
10
|
+
"paths": Array [],
|
|
11
|
+
},
|
|
12
|
+
"level": "error",
|
|
13
|
+
"path": Array [],
|
|
14
|
+
},
|
|
15
|
+
]
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
exports[`number greater than constraint: gt: too low, at limit 1`] = `
|
|
19
|
+
Array [
|
|
20
|
+
Object {
|
|
21
|
+
"item": ValidationError {
|
|
22
|
+
"children": undefined,
|
|
23
|
+
"message": "Must be greater than 10",
|
|
24
|
+
"operation": undefined,
|
|
25
|
+
"paths": Array [],
|
|
26
|
+
},
|
|
27
|
+
"level": "error",
|
|
28
|
+
"path": Array [],
|
|
29
|
+
},
|
|
30
|
+
]
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
exports[`number greater than constraint: gt: valid 1`] = `Array []`;
|
|
34
|
+
|
|
35
|
+
exports[`number integer constraint: integer: invalid (float) 1`] = `
|
|
36
|
+
Array [
|
|
37
|
+
Object {
|
|
38
|
+
"item": ValidationError {
|
|
39
|
+
"children": undefined,
|
|
40
|
+
"message": "Must be an integer",
|
|
41
|
+
"operation": undefined,
|
|
42
|
+
"paths": Array [],
|
|
43
|
+
},
|
|
44
|
+
"level": "error",
|
|
45
|
+
"path": Array [],
|
|
46
|
+
},
|
|
47
|
+
]
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
exports[`number integer constraint: integer: valid 1`] = `Array []`;
|
|
51
|
+
|
|
52
|
+
exports[`number less than constraint: lt: too high 1`] = `
|
|
53
|
+
Array [
|
|
54
|
+
Object {
|
|
55
|
+
"item": ValidationError {
|
|
56
|
+
"children": undefined,
|
|
57
|
+
"message": "Must be less than 10",
|
|
58
|
+
"operation": undefined,
|
|
59
|
+
"paths": Array [],
|
|
60
|
+
},
|
|
61
|
+
"level": "error",
|
|
62
|
+
"path": Array [],
|
|
63
|
+
},
|
|
64
|
+
]
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
exports[`number less than constraint: lt: too high, at limit 1`] = `
|
|
68
|
+
Array [
|
|
69
|
+
Object {
|
|
70
|
+
"item": ValidationError {
|
|
71
|
+
"children": undefined,
|
|
72
|
+
"message": "Must be less than 10",
|
|
73
|
+
"operation": undefined,
|
|
74
|
+
"paths": Array [],
|
|
75
|
+
},
|
|
76
|
+
"level": "error",
|
|
77
|
+
"path": Array [],
|
|
78
|
+
},
|
|
79
|
+
]
|
|
80
|
+
`;
|
|
81
|
+
|
|
82
|
+
exports[`number less than constraint: lt: valid 1`] = `Array []`;
|
|
83
|
+
|
|
84
|
+
exports[`number max constraint: max: too large 1`] = `
|
|
85
|
+
Array [
|
|
86
|
+
Object {
|
|
87
|
+
"item": ValidationError {
|
|
88
|
+
"children": undefined,
|
|
89
|
+
"message": "Must be less than or equal 10",
|
|
90
|
+
"operation": undefined,
|
|
91
|
+
"paths": Array [],
|
|
92
|
+
},
|
|
93
|
+
"level": "error",
|
|
94
|
+
"path": Array [],
|
|
95
|
+
},
|
|
96
|
+
]
|
|
97
|
+
`;
|
|
98
|
+
|
|
99
|
+
exports[`number max constraint: max: valid 1`] = `Array []`;
|
|
100
|
+
|
|
101
|
+
exports[`number max constraint: max: valid, at limit 1`] = `Array []`;
|
|
102
|
+
|
|
103
|
+
exports[`number min constraint: min: too low 1`] = `
|
|
104
|
+
Array [
|
|
105
|
+
Object {
|
|
106
|
+
"item": ValidationError {
|
|
107
|
+
"children": undefined,
|
|
108
|
+
"message": "Must be greater than or equal 10",
|
|
109
|
+
"operation": undefined,
|
|
110
|
+
"paths": Array [],
|
|
111
|
+
},
|
|
112
|
+
"level": "error",
|
|
113
|
+
"path": Array [],
|
|
114
|
+
},
|
|
115
|
+
]
|
|
116
|
+
`;
|
|
117
|
+
|
|
118
|
+
exports[`number min constraint: min: valid 1`] = `Array []`;
|
|
119
|
+
|
|
120
|
+
exports[`number min constraint: min: valid, at limit 1`] = `Array []`;
|
|
121
|
+
|
|
122
|
+
exports[`number negative constraint: negative: invalid (zero) 1`] = `
|
|
123
|
+
Array [
|
|
124
|
+
Object {
|
|
125
|
+
"item": ValidationError {
|
|
126
|
+
"children": undefined,
|
|
127
|
+
"message": "Must be less than 0",
|
|
128
|
+
"operation": undefined,
|
|
129
|
+
"paths": Array [],
|
|
130
|
+
},
|
|
131
|
+
"level": "error",
|
|
132
|
+
"path": Array [],
|
|
133
|
+
},
|
|
134
|
+
]
|
|
135
|
+
`;
|
|
136
|
+
|
|
137
|
+
exports[`number negative constraint: negative: invalid 1`] = `
|
|
138
|
+
Array [
|
|
139
|
+
Object {
|
|
140
|
+
"item": ValidationError {
|
|
141
|
+
"children": undefined,
|
|
142
|
+
"message": "Must be less than 0",
|
|
143
|
+
"operation": undefined,
|
|
144
|
+
"paths": Array [],
|
|
145
|
+
},
|
|
146
|
+
"level": "error",
|
|
147
|
+
"path": Array [],
|
|
148
|
+
},
|
|
149
|
+
]
|
|
150
|
+
`;
|
|
151
|
+
|
|
152
|
+
exports[`number negative constraint: negative: valid 1`] = `Array []`;
|
|
153
|
+
|
|
154
|
+
exports[`number positive constraint: positive: invalid 1`] = `
|
|
155
|
+
Array [
|
|
156
|
+
Object {
|
|
157
|
+
"item": ValidationError {
|
|
158
|
+
"children": undefined,
|
|
159
|
+
"message": "Must be greater than or equal 0",
|
|
160
|
+
"operation": undefined,
|
|
161
|
+
"paths": Array [],
|
|
162
|
+
},
|
|
163
|
+
"level": "error",
|
|
164
|
+
"path": Array [],
|
|
165
|
+
},
|
|
166
|
+
]
|
|
167
|
+
`;
|
|
168
|
+
|
|
169
|
+
exports[`number positive constraint: positive: valid (zero) 1`] = `Array []`;
|
|
170
|
+
|
|
171
|
+
exports[`number positive constraint: positive: valid 1`] = `Array []`;
|
|
172
|
+
|
|
173
|
+
exports[`number precision constraint: precision: invalid (pi) 1`] = `
|
|
174
|
+
Array [
|
|
175
|
+
Object {
|
|
176
|
+
"item": ValidationError {
|
|
177
|
+
"children": undefined,
|
|
178
|
+
"message": "Max precision is 3",
|
|
179
|
+
"operation": undefined,
|
|
180
|
+
"paths": Array [],
|
|
181
|
+
},
|
|
182
|
+
"level": "error",
|
|
183
|
+
"path": Array [],
|
|
184
|
+
},
|
|
185
|
+
]
|
|
186
|
+
`;
|
|
187
|
+
|
|
188
|
+
exports[`number precision constraint: precision: valid (at limit) 1`] = `Array []`;
|
|
189
|
+
|
|
190
|
+
exports[`number precision constraint: precision: valid (below limit) 1`] = `Array []`;
|
|
191
|
+
|
|
192
|
+
exports[`number required constraint: required: undefined 1`] = `
|
|
193
|
+
Array [
|
|
194
|
+
Object {
|
|
195
|
+
"item": ValidationError {
|
|
196
|
+
"children": undefined,
|
|
197
|
+
"message": "Value is required",
|
|
198
|
+
"operation": undefined,
|
|
199
|
+
"paths": Array [],
|
|
200
|
+
},
|
|
201
|
+
"level": "error",
|
|
202
|
+
"path": Array [],
|
|
203
|
+
},
|
|
204
|
+
]
|
|
205
|
+
`;
|
|
206
|
+
|
|
207
|
+
exports[`number required constraint: required: valid 1`] = `Array []`;
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`string custom async rule with string: not a palindrome 1`] = `
|
|
4
|
+
Array [
|
|
5
|
+
Object {
|
|
6
|
+
"item": ValidationError {
|
|
7
|
+
"children": undefined,
|
|
8
|
+
"message": "Must be a palindrome!",
|
|
9
|
+
"operation": undefined,
|
|
10
|
+
"paths": Array [],
|
|
11
|
+
},
|
|
12
|
+
"level": "error",
|
|
13
|
+
"path": Array [],
|
|
14
|
+
},
|
|
15
|
+
]
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
exports[`string custom rule with string: not a palindrome 1`] = `
|
|
19
|
+
Array [
|
|
20
|
+
Object {
|
|
21
|
+
"item": ValidationError {
|
|
22
|
+
"children": undefined,
|
|
23
|
+
"message": "Must be a palindrome!",
|
|
24
|
+
"operation": undefined,
|
|
25
|
+
"paths": Array [],
|
|
26
|
+
},
|
|
27
|
+
"level": "error",
|
|
28
|
+
"path": Array [],
|
|
29
|
+
},
|
|
30
|
+
]
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
exports[`string exact length constraint: exact length: too long 1`] = `
|
|
34
|
+
Array [
|
|
35
|
+
Object {
|
|
36
|
+
"item": ValidationError {
|
|
37
|
+
"children": undefined,
|
|
38
|
+
"message": "Must be exactly 5 characters long",
|
|
39
|
+
"operation": undefined,
|
|
40
|
+
"paths": Array [],
|
|
41
|
+
},
|
|
42
|
+
"level": "error",
|
|
43
|
+
"path": Array [],
|
|
44
|
+
},
|
|
45
|
+
]
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
exports[`string exact length constraint: exact length: too short 1`] = `
|
|
49
|
+
Array [
|
|
50
|
+
Object {
|
|
51
|
+
"item": ValidationError {
|
|
52
|
+
"children": undefined,
|
|
53
|
+
"message": "Must be exactly 5 characters long",
|
|
54
|
+
"operation": undefined,
|
|
55
|
+
"paths": Array [],
|
|
56
|
+
},
|
|
57
|
+
"level": "error",
|
|
58
|
+
"path": Array [],
|
|
59
|
+
},
|
|
60
|
+
]
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
exports[`string exact length constraint: exact length: valid 1`] = `Array []`;
|
|
64
|
+
|
|
65
|
+
exports[`string lowercase constraint: lowercase: all uppercase 1`] = `
|
|
66
|
+
Array [
|
|
67
|
+
Object {
|
|
68
|
+
"item": ValidationError {
|
|
69
|
+
"children": undefined,
|
|
70
|
+
"message": "Must be all lowercase letters",
|
|
71
|
+
"operation": undefined,
|
|
72
|
+
"paths": Array [],
|
|
73
|
+
},
|
|
74
|
+
"level": "error",
|
|
75
|
+
"path": Array [],
|
|
76
|
+
},
|
|
77
|
+
]
|
|
78
|
+
`;
|
|
79
|
+
|
|
80
|
+
exports[`string lowercase constraint: lowercase: locale characters 1`] = `
|
|
81
|
+
Array [
|
|
82
|
+
Object {
|
|
83
|
+
"item": ValidationError {
|
|
84
|
+
"children": undefined,
|
|
85
|
+
"message": "Must be all lowercase letters",
|
|
86
|
+
"operation": undefined,
|
|
87
|
+
"paths": Array [],
|
|
88
|
+
},
|
|
89
|
+
"level": "error",
|
|
90
|
+
"path": Array [],
|
|
91
|
+
},
|
|
92
|
+
]
|
|
93
|
+
`;
|
|
94
|
+
|
|
95
|
+
exports[`string lowercase constraint: lowercase: some uppercase 1`] = `
|
|
96
|
+
Array [
|
|
97
|
+
Object {
|
|
98
|
+
"item": ValidationError {
|
|
99
|
+
"children": undefined,
|
|
100
|
+
"message": "Must be all lowercase letters",
|
|
101
|
+
"operation": undefined,
|
|
102
|
+
"paths": Array [],
|
|
103
|
+
},
|
|
104
|
+
"level": "error",
|
|
105
|
+
"path": Array [],
|
|
106
|
+
},
|
|
107
|
+
]
|
|
108
|
+
`;
|
|
109
|
+
|
|
110
|
+
exports[`string lowercase constraint: lowercase: valid 1`] = `Array []`;
|
|
111
|
+
|
|
112
|
+
exports[`string max length constraint: max length: too long 1`] = `
|
|
113
|
+
Array [
|
|
114
|
+
Object {
|
|
115
|
+
"item": ValidationError {
|
|
116
|
+
"children": undefined,
|
|
117
|
+
"message": "Must be at most 5 characters long",
|
|
118
|
+
"operation": undefined,
|
|
119
|
+
"paths": Array [],
|
|
120
|
+
},
|
|
121
|
+
"level": "error",
|
|
122
|
+
"path": Array [],
|
|
123
|
+
},
|
|
124
|
+
]
|
|
125
|
+
`;
|
|
126
|
+
|
|
127
|
+
exports[`string max length constraint: max length: valid 1`] = `Array []`;
|
|
128
|
+
|
|
129
|
+
exports[`string min length constraint: min length: too short 1`] = `
|
|
130
|
+
Array [
|
|
131
|
+
Object {
|
|
132
|
+
"item": ValidationError {
|
|
133
|
+
"children": undefined,
|
|
134
|
+
"message": "Must be at least 2 characters long",
|
|
135
|
+
"operation": undefined,
|
|
136
|
+
"paths": Array [],
|
|
137
|
+
},
|
|
138
|
+
"level": "error",
|
|
139
|
+
"path": Array [],
|
|
140
|
+
},
|
|
141
|
+
]
|
|
142
|
+
`;
|
|
143
|
+
|
|
144
|
+
exports[`string min length constraint: min length: valid 1`] = `Array []`;
|
|
145
|
+
|
|
146
|
+
exports[`string regex constraint (custom pattern name): regex: match w/ custom pattern name 1`] = `Array []`;
|
|
147
|
+
|
|
148
|
+
exports[`string regex constraint (custom pattern name): regex: non-match w/ custom pattern name 1`] = `
|
|
149
|
+
Array [
|
|
150
|
+
Object {
|
|
151
|
+
"item": ValidationError {
|
|
152
|
+
"children": undefined,
|
|
153
|
+
"message": "Does not match PascalCase-pattern",
|
|
154
|
+
"operation": undefined,
|
|
155
|
+
"paths": Array [],
|
|
156
|
+
},
|
|
157
|
+
"level": "error",
|
|
158
|
+
"path": Array [],
|
|
159
|
+
},
|
|
160
|
+
]
|
|
161
|
+
`;
|
|
162
|
+
|
|
163
|
+
exports[`string regex constraint (custom pattern name, as options): regex: match w/ custom pattern name (opt) 1`] = `Array []`;
|
|
164
|
+
|
|
165
|
+
exports[`string regex constraint (custom pattern name, as options): regex: non-match w/ custom pattern name (opt) 1`] = `
|
|
166
|
+
Array [
|
|
167
|
+
Object {
|
|
168
|
+
"item": ValidationError {
|
|
169
|
+
"children": undefined,
|
|
170
|
+
"message": "Does not match PascalCase-pattern",
|
|
171
|
+
"operation": undefined,
|
|
172
|
+
"paths": Array [],
|
|
173
|
+
},
|
|
174
|
+
"level": "error",
|
|
175
|
+
"path": Array [],
|
|
176
|
+
},
|
|
177
|
+
]
|
|
178
|
+
`;
|
|
179
|
+
|
|
180
|
+
exports[`string regex constraint (inverted): regex: inverted match 1`] = `
|
|
181
|
+
Array [
|
|
182
|
+
Object {
|
|
183
|
+
"item": ValidationError {
|
|
184
|
+
"children": undefined,
|
|
185
|
+
"message": "Should not match \\"/^[A-Z][a-z]+$/\\"-pattern",
|
|
186
|
+
"operation": undefined,
|
|
187
|
+
"paths": Array [],
|
|
188
|
+
},
|
|
189
|
+
"level": "error",
|
|
190
|
+
"path": Array [],
|
|
191
|
+
},
|
|
192
|
+
]
|
|
193
|
+
`;
|
|
194
|
+
|
|
195
|
+
exports[`string regex constraint (inverted): regex: inverted non-match 1`] = `Array []`;
|
|
196
|
+
|
|
197
|
+
exports[`string regex constraint: regex: match 1`] = `Array []`;
|
|
198
|
+
|
|
199
|
+
exports[`string regex constraint: regex: non-match 1`] = `
|
|
200
|
+
Array [
|
|
201
|
+
Object {
|
|
202
|
+
"item": ValidationError {
|
|
203
|
+
"children": undefined,
|
|
204
|
+
"message": "Does not match \\"/^[A-Z][a-z]+$/\\"-pattern",
|
|
205
|
+
"operation": undefined,
|
|
206
|
+
"paths": Array [],
|
|
207
|
+
},
|
|
208
|
+
"level": "error",
|
|
209
|
+
"path": Array [],
|
|
210
|
+
},
|
|
211
|
+
]
|
|
212
|
+
`;
|
|
213
|
+
|
|
214
|
+
exports[`string required constraint: required: empty string 1`] = `
|
|
215
|
+
Array [
|
|
216
|
+
Object {
|
|
217
|
+
"item": ValidationError {
|
|
218
|
+
"children": undefined,
|
|
219
|
+
"message": "Required",
|
|
220
|
+
"operation": undefined,
|
|
221
|
+
"paths": Array [],
|
|
222
|
+
},
|
|
223
|
+
"level": "error",
|
|
224
|
+
"path": Array [],
|
|
225
|
+
},
|
|
226
|
+
]
|
|
227
|
+
`;
|
|
228
|
+
|
|
229
|
+
exports[`string required constraint: required: null 1`] = `
|
|
230
|
+
Array [
|
|
231
|
+
Object {
|
|
232
|
+
"item": ValidationError {
|
|
233
|
+
"children": undefined,
|
|
234
|
+
"message": "Expected type \\"String\\", got \\"null\\"",
|
|
235
|
+
"operation": undefined,
|
|
236
|
+
"paths": Array [],
|
|
237
|
+
},
|
|
238
|
+
"level": "error",
|
|
239
|
+
"path": Array [],
|
|
240
|
+
},
|
|
241
|
+
Object {
|
|
242
|
+
"item": ValidationError {
|
|
243
|
+
"children": undefined,
|
|
244
|
+
"message": "Required",
|
|
245
|
+
"operation": undefined,
|
|
246
|
+
"paths": Array [],
|
|
247
|
+
},
|
|
248
|
+
"level": "error",
|
|
249
|
+
"path": Array [],
|
|
250
|
+
},
|
|
251
|
+
]
|
|
252
|
+
`;
|
|
253
|
+
|
|
254
|
+
exports[`string required constraint: required: undefined 1`] = `
|
|
255
|
+
Array [
|
|
256
|
+
Object {
|
|
257
|
+
"item": ValidationError {
|
|
258
|
+
"children": undefined,
|
|
259
|
+
"message": "Required",
|
|
260
|
+
"operation": undefined,
|
|
261
|
+
"paths": Array [],
|
|
262
|
+
},
|
|
263
|
+
"level": "error",
|
|
264
|
+
"path": Array [],
|
|
265
|
+
},
|
|
266
|
+
]
|
|
267
|
+
`;
|
|
268
|
+
|
|
269
|
+
exports[`string required constraint: required: valid 1`] = `Array []`;
|
|
270
|
+
|
|
271
|
+
exports[`string uppercase constraint: uppercase: all lowercase 1`] = `
|
|
272
|
+
Array [
|
|
273
|
+
Object {
|
|
274
|
+
"item": ValidationError {
|
|
275
|
+
"children": undefined,
|
|
276
|
+
"message": "Must be all uppercase letters",
|
|
277
|
+
"operation": undefined,
|
|
278
|
+
"paths": Array [],
|
|
279
|
+
},
|
|
280
|
+
"level": "error",
|
|
281
|
+
"path": Array [],
|
|
282
|
+
},
|
|
283
|
+
]
|
|
284
|
+
`;
|
|
285
|
+
|
|
286
|
+
exports[`string uppercase constraint: uppercase: locale characters 1`] = `
|
|
287
|
+
Array [
|
|
288
|
+
Object {
|
|
289
|
+
"item": ValidationError {
|
|
290
|
+
"children": undefined,
|
|
291
|
+
"message": "Must be all uppercase letters",
|
|
292
|
+
"operation": undefined,
|
|
293
|
+
"paths": Array [],
|
|
294
|
+
},
|
|
295
|
+
"level": "error",
|
|
296
|
+
"path": Array [],
|
|
297
|
+
},
|
|
298
|
+
]
|
|
299
|
+
`;
|
|
300
|
+
|
|
301
|
+
exports[`string uppercase constraint: uppercase: some lowercase 1`] = `
|
|
302
|
+
Array [
|
|
303
|
+
Object {
|
|
304
|
+
"item": ValidationError {
|
|
305
|
+
"children": undefined,
|
|
306
|
+
"message": "Must be all uppercase letters",
|
|
307
|
+
"operation": undefined,
|
|
308
|
+
"paths": Array [],
|
|
309
|
+
},
|
|
310
|
+
"level": "error",
|
|
311
|
+
"path": Array [],
|
|
312
|
+
},
|
|
313
|
+
]
|
|
314
|
+
`;
|
|
315
|
+
|
|
316
|
+
exports[`string uppercase constraint: uppercase: some lowercase 2`] = `
|
|
317
|
+
Array [
|
|
318
|
+
Object {
|
|
319
|
+
"item": ValidationError {
|
|
320
|
+
"children": undefined,
|
|
321
|
+
"message": "Must be all uppercase letters",
|
|
322
|
+
"operation": undefined,
|
|
323
|
+
"paths": Array [],
|
|
324
|
+
},
|
|
325
|
+
"level": "error",
|
|
326
|
+
"path": Array [],
|
|
327
|
+
},
|
|
328
|
+
]
|
|
329
|
+
`;
|
|
330
|
+
|
|
331
|
+
exports[`string uppercase constraint: uppercase: valid 1`] = `Array []`;
|
|
332
|
+
|
|
333
|
+
exports[`string uri constraint (credentials): uri: credentials specified but not allowed 1`] = `
|
|
334
|
+
Array [
|
|
335
|
+
Object {
|
|
336
|
+
"item": ValidationError {
|
|
337
|
+
"children": undefined,
|
|
338
|
+
"message": "Username/password not allowed",
|
|
339
|
+
"operation": undefined,
|
|
340
|
+
"paths": Array [],
|
|
341
|
+
},
|
|
342
|
+
"level": "error",
|
|
343
|
+
"path": Array [],
|
|
344
|
+
},
|
|
345
|
+
]
|
|
346
|
+
`;
|
|
347
|
+
|
|
348
|
+
exports[`string uri constraint (credentials): uri: username specified but not allowed 1`] = `
|
|
349
|
+
Array [
|
|
350
|
+
Object {
|
|
351
|
+
"item": ValidationError {
|
|
352
|
+
"children": undefined,
|
|
353
|
+
"message": "Username/password not allowed",
|
|
354
|
+
"operation": undefined,
|
|
355
|
+
"paths": Array [],
|
|
356
|
+
},
|
|
357
|
+
"level": "error",
|
|
358
|
+
"path": Array [],
|
|
359
|
+
},
|
|
360
|
+
]
|
|
361
|
+
`;
|
|
362
|
+
|
|
363
|
+
exports[`string uri constraint (invalid protocol): uri: protocol non-match 1`] = `
|
|
364
|
+
Array [
|
|
365
|
+
Object {
|
|
366
|
+
"item": ValidationError {
|
|
367
|
+
"children": undefined,
|
|
368
|
+
"message": "Does not match allowed protocols/schemes",
|
|
369
|
+
"operation": undefined,
|
|
370
|
+
"paths": Array [],
|
|
371
|
+
},
|
|
372
|
+
"level": "error",
|
|
373
|
+
"path": Array [],
|
|
374
|
+
},
|
|
375
|
+
]
|
|
376
|
+
`;
|
|
377
|
+
|
|
378
|
+
exports[`string uri constraint (with unicode chars): uri: non-match 1`] = `
|
|
379
|
+
Array [
|
|
380
|
+
Object {
|
|
381
|
+
"item": ValidationError {
|
|
382
|
+
"children": undefined,
|
|
383
|
+
"message": "Not a valid URL",
|
|
384
|
+
"operation": undefined,
|
|
385
|
+
"paths": Array [],
|
|
386
|
+
},
|
|
387
|
+
"level": "error",
|
|
388
|
+
"path": Array [],
|
|
389
|
+
},
|
|
390
|
+
]
|
|
391
|
+
`;
|
|
392
|
+
|
|
393
|
+
exports[`string uri constraint: uri: non-match 1`] = `
|
|
394
|
+
Array [
|
|
395
|
+
Object {
|
|
396
|
+
"item": ValidationError {
|
|
397
|
+
"children": undefined,
|
|
398
|
+
"message": "Not a valid URL",
|
|
399
|
+
"operation": undefined,
|
|
400
|
+
"paths": Array [],
|
|
401
|
+
},
|
|
402
|
+
"level": "error",
|
|
403
|
+
"path": Array [],
|
|
404
|
+
},
|
|
405
|
+
]
|
|
406
|
+
`;
|