Skip to content

Commit 2e64487

Browse files
committed
testing draft-6 formats
1 parent 722d73f commit 2e64487

File tree

1 file changed

+388
-0
lines changed
  • tests/src/test/resources/org/everit/json/schema/draft6

1 file changed

+388
-0
lines changed
Lines changed: 388 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,388 @@
1+
[
2+
{
3+
"description": "validation of date-time strings",
4+
"schema": {"format": "date-time"},
5+
"tests": [
6+
{
7+
"description": "a valid date-time string",
8+
"data": "1963-06-19T08:30:06.283185Z",
9+
"valid": true
10+
},
11+
{
12+
"description": "an invalid date-time string",
13+
"data": "06/19/1963 08:30:06 PST",
14+
"valid": false
15+
},
16+
{
17+
"description": "only RFC3339 not all of ISO 8601 are valid",
18+
"data": "2013-350T01:01:01",
19+
"valid": false
20+
}
21+
]
22+
},
23+
{
24+
"description": "validation of URIs",
25+
"schema": {"format": "uri"},
26+
"tests": [
27+
{
28+
"description": "a valid URI",
29+
"data": "http://foo.bar/?baz=qux#quux",
30+
"valid": true
31+
},
32+
{
33+
"description": "an invalid protocol-relative URI Reference",
34+
"data": "//foo.bar/?baz=qux#quux",
35+
"valid": false
36+
},
37+
{
38+
"description": "an invalid relative URI Reference",
39+
"data": "/abc",
40+
"valid": false
41+
},
42+
{
43+
"description": "an invalid URI",
44+
"data": "\\\\WINDOWS\\fileshare",
45+
"valid": false
46+
},
47+
{
48+
"description": "an invalid URI though valid URI reference",
49+
"data": "abc",
50+
"valid": false
51+
}
52+
]
53+
},
54+
{
55+
"description": "validation of URI References",
56+
"schema": {"format": "uri-reference"},
57+
"tests": [
58+
{
59+
"description": "a valid URI",
60+
"data": "http://foo.bar/?baz=qux#quux",
61+
"valid": true
62+
},
63+
{
64+
"description": "a valid protocol-relative URI Reference",
65+
"data": "//foo.bar/?baz=qux#quux",
66+
"valid": true
67+
},
68+
{
69+
"description": "a valid relative URI Reference",
70+
"data": "/abc",
71+
"valid": true
72+
},
73+
{
74+
"description": "an invalid URI Reference",
75+
"data": "\\\\WINDOWS\\fileshare",
76+
"valid": false
77+
},
78+
{
79+
"description": "a valid URI Reference",
80+
"data": "abc",
81+
"valid": true
82+
},
83+
{
84+
"description": "a valid URI fragment",
85+
"data": "#fragment",
86+
"valid": true
87+
},
88+
{
89+
"description": "an invalid URI fragment",
90+
"data": "#frag\\ment",
91+
"valid": false
92+
}
93+
]
94+
},
95+
{
96+
"description": "format: uri-template",
97+
"schema": {
98+
"format": "uri-template"
99+
},
100+
"tests": [
101+
{
102+
"description": "a valid uri-template",
103+
"data": "http://example.com/dictionary/{term:1}/{term}",
104+
"valid": true
105+
},
106+
{
107+
"description": "an invalid uri-template",
108+
"data": "http://example.com/dictionary/{term:1}/{term",
109+
"valid": false
110+
},
111+
{
112+
"description": "a valid uri-template without variables",
113+
"data": "http://example.com/dictionary",
114+
"valid": true
115+
},
116+
{
117+
"description": "a valid relative uri-template",
118+
"data": "dictionary/{term:1}/{term}",
119+
"valid": true
120+
}
121+
]
122+
},
123+
{
124+
"description": "validation of e-mail addresses",
125+
"schema": {"format": "email"},
126+
"tests": [
127+
{
128+
"description": "a valid e-mail address",
129+
"data": "[email protected]",
130+
"valid": true
131+
},
132+
{
133+
"description": "an invalid e-mail address",
134+
"data": "2962",
135+
"valid": false
136+
}
137+
]
138+
},
139+
{
140+
"description": "validation of IP addresses",
141+
"schema": {"format": "ipv4"},
142+
"tests": [
143+
{
144+
"description": "a valid IP address",
145+
"data": "192.168.0.1",
146+
"valid": true
147+
},
148+
{
149+
"description": "an IP address with too many components",
150+
"data": "127.0.0.0.1",
151+
"valid": false
152+
},
153+
{
154+
"description": "an IP address with out-of-range values",
155+
"data": "256.256.256.256",
156+
"valid": false
157+
},
158+
{
159+
"description": "an IP address without 4 components",
160+
"data": "127.0",
161+
"valid": false
162+
},
163+
{
164+
"description": "an IP address as an integer",
165+
"data": "0x7f000001",
166+
"valid": false
167+
}
168+
]
169+
},
170+
{
171+
"description": "validation of IPv6 addresses",
172+
"schema": {"format": "ipv6"},
173+
"tests": [
174+
{
175+
"description": "a valid IPv6 address",
176+
"data": "::1",
177+
"valid": true
178+
},
179+
{
180+
"description": "an IPv6 address with out-of-range values",
181+
"data": "12345::",
182+
"valid": false
183+
},
184+
{
185+
"description": "an IPv6 address with too many components",
186+
"data": "1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1",
187+
"valid": false
188+
},
189+
{
190+
"description": "an IPv6 address containing illegal characters",
191+
"data": "::laptop",
192+
"valid": false
193+
}
194+
]
195+
},
196+
{
197+
"description": "validation of host names",
198+
"schema": {"format": "hostname"},
199+
"tests": [
200+
{
201+
"description": "a valid host name",
202+
"data": "www.example.com",
203+
"valid": true
204+
},
205+
{
206+
"description": "a host name starting with an illegal character",
207+
"data": "-a-host-name-that-starts-with--",
208+
"valid": false
209+
},
210+
{
211+
"description": "a host name containing illegal characters",
212+
"data": "not_a_valid_host_name",
213+
"valid": false
214+
},
215+
{
216+
"description": "a host name with a component too long",
217+
"data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
218+
"valid": false
219+
}
220+
]
221+
},
222+
{
223+
"description": "validation of JSON-pointers (JSON String Representation)",
224+
"schema": {"format": "json-pointer"},
225+
"tests": [
226+
{
227+
"description": "a valid JSON-pointer",
228+
"data": "/foo/bar~0/baz~1/%a",
229+
"valid": true
230+
},
231+
{
232+
"description": "not a valid JSON-pointer (~ not escaped)",
233+
"data": "/foo/bar~",
234+
"valid": false
235+
},
236+
{
237+
"description": "valid JSON-pointer with empty segment",
238+
"data": "/foo//bar",
239+
"valid": true
240+
},
241+
{
242+
"description": "valid JSON-pointer with the last empty segment",
243+
"data": "/foo/bar/",
244+
"valid": true
245+
},
246+
{
247+
"description": "valid JSON-pointer as stated in RFC 6901 #1",
248+
"data": "",
249+
"valid": true
250+
},
251+
{
252+
"description": "valid JSON-pointer as stated in RFC 6901 #2",
253+
"data": "/foo",
254+
"valid": true
255+
},
256+
{
257+
"description": "valid JSON-pointer as stated in RFC 6901 #3",
258+
"data": "/foo/0",
259+
"valid": true
260+
},
261+
{
262+
"description": "valid JSON-pointer as stated in RFC 6901 #4",
263+
"data": "/",
264+
"valid": true
265+
},
266+
{
267+
"description": "valid JSON-pointer as stated in RFC 6901 #5",
268+
"data": "/a~1b",
269+
"valid": true
270+
},
271+
{
272+
"description": "valid JSON-pointer as stated in RFC 6901 #6",
273+
"data": "/c%d",
274+
"valid": true
275+
},
276+
{
277+
"description": "valid JSON-pointer as stated in RFC 6901 #7",
278+
"data": "/e^f",
279+
"valid": true
280+
},
281+
{
282+
"description": "valid JSON-pointer as stated in RFC 6901 #8",
283+
"data": "/g|h",
284+
"valid": true
285+
},
286+
{
287+
"description": "valid JSON-pointer as stated in RFC 6901 #9",
288+
"data": "/i\\j",
289+
"valid": true
290+
},
291+
{
292+
"description": "valid JSON-pointer as stated in RFC 6901 #10",
293+
"data": "/k\"l",
294+
"valid": true
295+
},
296+
{
297+
"description": "valid JSON-pointer as stated in RFC 6901 #11",
298+
"data": "/ ",
299+
"valid": true
300+
},
301+
{
302+
"description": "valid JSON-pointer as stated in RFC 6901 #12",
303+
"data": "/m~0n",
304+
"valid": true
305+
},
306+
{
307+
"description": "valid JSON-pointer used adding to the last array position",
308+
"data": "/foo/-",
309+
"valid": true
310+
},
311+
{
312+
"description": "valid JSON-pointer (- used as object member name)",
313+
"data": "/foo/-/bar",
314+
"valid": true
315+
},
316+
{
317+
"description": "valid JSON-pointer (multiple escaped characters)",
318+
"data": "/~1~0~0~1~1",
319+
"valid": true
320+
},
321+
{
322+
"description": "valid JSON-pointer (escaped with fraction part) #1",
323+
"data": "/~1.1",
324+
"valid": true
325+
},
326+
{
327+
"description": "valid JSON-pointer (escaped with fraction part) #2",
328+
"data": "/~0.1",
329+
"valid": true
330+
},
331+
{
332+
"description": "not a valid JSON-pointer (URI Fragment Identifier) #1",
333+
"data": "#",
334+
"valid": false
335+
},
336+
{
337+
"description": "not a valid JSON-pointer (URI Fragment Identifier) #2",
338+
"data": "#/",
339+
"valid": false
340+
},
341+
{
342+
"description": "not a valid JSON-pointer (URI Fragment Identifier) #3",
343+
"data": "#a",
344+
"valid": false
345+
},
346+
{
347+
"description": "not a valid JSON-pointer (some escaped, but not all) #1",
348+
"data": "/~0~",
349+
"valid": false
350+
},
351+
{
352+
"description": "not a valid JSON-pointer (some escaped, but not all) #2",
353+
"data": "/~0/~",
354+
"valid": false
355+
},
356+
{
357+
"description": "not a valid JSON-pointer (wrong escape character) #1",
358+
"data": "/~2",
359+
"valid": false
360+
},
361+
{
362+
"description": "not a valid JSON-pointer (wrong escape character) #2",
363+
"data": "/~-1",
364+
"valid": false
365+
},
366+
{
367+
"description": "not a valid JSON-pointer (multiple characters not escaped)",
368+
"data": "/~~",
369+
"valid": false
370+
},
371+
{
372+
"description": "not a valid JSON-pointer (isn't empty nor starts with /) #1",
373+
"data": "a",
374+
"valid": false
375+
},
376+
{
377+
"description": "not a valid JSON-pointer (isn't empty nor starts with /) #2",
378+
"data": "0",
379+
"valid": false
380+
},
381+
{
382+
"description": "not a valid JSON-pointer (isn't empty nor starts with /) #3",
383+
"data": "a/a",
384+
"valid": false
385+
}
386+
]
387+
}
388+
]

0 commit comments

Comments
 (0)