Skip to content

Commit 41b892c

Browse files
committed
Merge branch 'master' into fix/property-names-with-enum
2 parents ebe9c97 + 350f24b commit 41b892c

File tree

15 files changed

+641
-3
lines changed

15 files changed

+641
-3
lines changed

src/test/java/dev/harrel/jsonschema/SpecificationSuiteTest.java

+5
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,11 @@ private static Map<String, Map<String, Set<String>>> skippedFormatTests() {
287287
"ZERO WIDTH JOINER preceded by Virama",
288288
"ZERO WIDTH NON-JOINER preceded by Virama",
289289
"ZERO WIDTH NON-JOINER not preceded by Virama but matches regexp"
290+
),
291+
"validation of separators in internationalized host names", Set.of(
292+
"ideographic full stop as label separator",
293+
"fullwidth full stop as label separator",
294+
"halfwidth ideographic full stop as label separator"
290295
)
291296
),
292297
"ipv4", Map.of(

src/test/resources/suite-yaml/tests/draft2019-09/optional/format/idn-hostname.yml

+29
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,35 @@
215215
- description: empty string
216216
data: ""
217217
valid: false
218+
- description: validation of separators in internationalized host names
219+
specification:
220+
- rfc3490: "3.1"
221+
quote: 'Whenever dots are used as label separators, the following characters MUST be recognized as dots: U+002E (full stop), U+3002 (ideographic full stop), U+FF0E (fullwidth full stop), U+FF61(halfwidth ideographic full stop)'
222+
schema:
223+
$schema: https://json-schema.org/draft/2019-09/schema
224+
format: idn-hostname
225+
tests:
218226
- description: single dot
219227
data: .
220228
valid: false
229+
- description: single ideographic full stop
230+
data:
231+
valid: false
232+
- description: single fullwidth full stop
233+
data:
234+
valid: false
235+
- description: single halfwidth ideographic full stop
236+
data:
237+
valid: false
238+
- description: dot as label separator
239+
data: a.b
240+
valid: true
241+
- description: ideographic full stop as label separator
242+
data: a。b
243+
valid: true
244+
- description: fullwidth full stop as label separator
245+
data: a.b
246+
valid: true
247+
- description: halfwidth ideographic full stop as label separator
248+
data: a。b
249+
valid: true

src/test/resources/suite-yaml/tests/draft2019-09/propertyNames.yml

+41
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,44 @@
7373
- description: empty object is valid
7474
data: {}
7575
valid: true
76+
- description: propertyNames with const
77+
schema:
78+
$schema: https://json-schema.org/draft/2019-09/schema
79+
propertyNames:
80+
const: foo
81+
tests:
82+
- description: object with property foo is valid
83+
data:
84+
foo: 1
85+
valid: true
86+
- description: object with any other property is invalid
87+
data:
88+
bar: 1
89+
valid: false
90+
- description: empty object is valid
91+
data: {}
92+
valid: true
93+
- description: propertyNames with enum
94+
schema:
95+
$schema: https://json-schema.org/draft/2019-09/schema
96+
propertyNames:
97+
enum:
98+
- foo
99+
- bar
100+
tests:
101+
- description: object with property foo is valid
102+
data:
103+
foo: 1
104+
valid: true
105+
- description: object with property foo and bar is valid
106+
data:
107+
foo: 1
108+
bar: 1
109+
valid: true
110+
- description: object with any other property is invalid
111+
data:
112+
baz: 1
113+
valid: false
114+
- description: empty object is valid
115+
data: {}
116+
valid: true

src/test/resources/suite-yaml/tests/draft2020-12/optional/format/idn-hostname.yml

+29
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,35 @@
215215
- description: empty string
216216
data: ""
217217
valid: false
218+
- description: validation of separators in internationalized host names
219+
specification:
220+
- rfc3490: "3.1"
221+
quote: 'Whenever dots are used as label separators, the following characters MUST be recognized as dots: U+002E (full stop), U+3002 (ideographic full stop), U+FF0E (fullwidth full stop), U+FF61(halfwidth ideographic full stop)'
222+
schema:
223+
$schema: https://json-schema.org/draft/2020-12/schema
224+
format: idn-hostname
225+
tests:
218226
- description: single dot
219227
data: .
220228
valid: false
229+
- description: single ideographic full stop
230+
data:
231+
valid: false
232+
- description: single fullwidth full stop
233+
data:
234+
valid: false
235+
- description: single halfwidth ideographic full stop
236+
data:
237+
valid: false
238+
- description: dot as label separator
239+
data: a.b
240+
valid: true
241+
- description: ideographic full stop as label separator
242+
data: a。b
243+
valid: true
244+
- description: fullwidth full stop as label separator
245+
data: a.b
246+
valid: true
247+
- description: halfwidth ideographic full stop as label separator
248+
data: a。b
249+
valid: true

src/test/resources/suite-yaml/tests/draft2020-12/propertyNames.yml

+60
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,25 @@
3030
- description: ignores other non-objects
3131
data: 12
3232
valid: true
33+
- description: propertyNames validation with pattern
34+
schema:
35+
$schema: https://json-schema.org/draft/2020-12/schema
36+
propertyNames:
37+
pattern: ^a+$
38+
tests:
39+
- description: matching property names valid
40+
data:
41+
a: {}
42+
aa: {}
43+
aaa: {}
44+
valid: true
45+
- description: non-matching property name is invalid
46+
data:
47+
aaA: {}
48+
valid: false
49+
- description: object without properties is valid
50+
data: {}
51+
valid: true
3352
- description: propertyNames with boolean schema true
3453
schema:
3554
$schema: https://json-schema.org/draft/2020-12/schema
@@ -54,3 +73,44 @@
5473
- description: empty object is valid
5574
data: {}
5675
valid: true
76+
- description: propertyNames with const
77+
schema:
78+
$schema: https://json-schema.org/draft/2020-12/schema
79+
propertyNames:
80+
const: foo
81+
tests:
82+
- description: object with property foo is valid
83+
data:
84+
foo: 1
85+
valid: true
86+
- description: object with any other property is invalid
87+
data:
88+
bar: 1
89+
valid: false
90+
- description: empty object is valid
91+
data: {}
92+
valid: true
93+
- description: propertyNames with enum
94+
schema:
95+
$schema: https://json-schema.org/draft/2020-12/schema
96+
propertyNames:
97+
enum:
98+
- foo
99+
- bar
100+
tests:
101+
- description: object with property foo is valid
102+
data:
103+
foo: 1
104+
valid: true
105+
- description: object with property foo and bar is valid
106+
data:
107+
foo: 1
108+
bar: 1
109+
valid: true
110+
- description: object with any other property is invalid
111+
data:
112+
baz: 1
113+
valid: false
114+
- description: empty object is valid
115+
data: {}
116+
valid: true

src/test/resources/suite-yaml/tests/draft6/propertyNames.yml

+39
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,42 @@
6969
- description: empty object is valid
7070
data: {}
7171
valid: true
72+
- description: propertyNames with const
73+
schema:
74+
propertyNames:
75+
const: foo
76+
tests:
77+
- description: object with property foo is valid
78+
data:
79+
foo: 1
80+
valid: true
81+
- description: object with any other property is invalid
82+
data:
83+
bar: 1
84+
valid: false
85+
- description: empty object is valid
86+
data: {}
87+
valid: true
88+
- description: propertyNames with enum
89+
schema:
90+
propertyNames:
91+
enum:
92+
- foo
93+
- bar
94+
tests:
95+
- description: object with property foo is valid
96+
data:
97+
foo: 1
98+
valid: true
99+
- description: object with property foo and bar is valid
100+
data:
101+
foo: 1
102+
bar: 1
103+
valid: true
104+
- description: object with any other property is invalid
105+
data:
106+
baz: 1
107+
valid: false
108+
- description: empty object is valid
109+
data: {}
110+
valid: true

src/test/resources/suite-yaml/tests/draft7/optional/format/idn-hostname.yml

+28
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,34 @@
211211
- description: empty string
212212
data: ""
213213
valid: false
214+
- description: validation of separators in internationalized host names
215+
specification:
216+
- rfc3490: "3.1"
217+
quote: 'Whenever dots are used as label separators, the following characters MUST be recognized as dots: U+002E (full stop), U+3002 (ideographic full stop), U+FF0E (fullwidth full stop), U+FF61(halfwidth ideographic full stop)'
218+
schema:
219+
format: idn-hostname
220+
tests:
214221
- description: single dot
215222
data: .
216223
valid: false
224+
- description: single ideographic full stop
225+
data:
226+
valid: false
227+
- description: single fullwidth full stop
228+
data:
229+
valid: false
230+
- description: single halfwidth ideographic full stop
231+
data:
232+
valid: false
233+
- description: dot as label separator
234+
data: a.b
235+
valid: true
236+
- description: ideographic full stop as label separator
237+
data: a。b
238+
valid: true
239+
- description: fullwidth full stop as label separator
240+
data: a.b
241+
valid: true
242+
- description: halfwidth ideographic full stop as label separator
243+
data: a。b
244+
valid: true

src/test/resources/suite-yaml/tests/draft7/propertyNames.yml

+39
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,42 @@
6969
- description: empty object is valid
7070
data: {}
7171
valid: true
72+
- description: propertyNames with const
73+
schema:
74+
propertyNames:
75+
const: foo
76+
tests:
77+
- description: object with property foo is valid
78+
data:
79+
foo: 1
80+
valid: true
81+
- description: object with any other property is invalid
82+
data:
83+
bar: 1
84+
valid: false
85+
- description: empty object is valid
86+
data: {}
87+
valid: true
88+
- description: propertyNames with enum
89+
schema:
90+
propertyNames:
91+
enum:
92+
- foo
93+
- bar
94+
tests:
95+
- description: object with property foo is valid
96+
data:
97+
foo: 1
98+
valid: true
99+
- description: object with property foo and bar is valid
100+
data:
101+
foo: 1
102+
bar: 1
103+
valid: true
104+
- description: object with any other property is invalid
105+
data:
106+
baz: 1
107+
valid: false
108+
- description: empty object is valid
109+
data: {}
110+
valid: true

src/test/resources/suite/tests/draft2019-09/optional/format/idn-hostname.json

+48-1
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,58 @@
331331
"description": "empty string",
332332
"data": "",
333333
"valid": false
334-
},
334+
}
335+
]
336+
},
337+
{
338+
"description": "validation of separators in internationalized host names",
339+
"specification": [
340+
{"rfc3490": "3.1", "quote": "Whenever dots are used as label separators, the following characters MUST be recognized as dots: U+002E (full stop), U+3002 (ideographic full stop), U+FF0E (fullwidth full stop), U+FF61(halfwidth ideographic full stop)"}
341+
],
342+
"schema": {
343+
"$schema": "https://json-schema.org/draft/2019-09/schema",
344+
"format": "idn-hostname"
345+
},
346+
"tests": [
335347
{
336348
"description": "single dot",
337349
"data": ".",
338350
"valid": false
351+
},
352+
{
353+
"description": "single ideographic full stop",
354+
"data": "\u3002",
355+
"valid": false
356+
},
357+
{
358+
"description": "single fullwidth full stop",
359+
"data": "\uff0e",
360+
"valid": false
361+
},
362+
{
363+
"description": "single halfwidth ideographic full stop",
364+
"data": "\uff61",
365+
"valid": false
366+
},
367+
{
368+
"description": "dot as label separator",
369+
"data": "a.b",
370+
"valid": true
371+
},
372+
{
373+
"description": "ideographic full stop as label separator",
374+
"data": "a\u3002b",
375+
"valid": true
376+
},
377+
{
378+
"description": "fullwidth full stop as label separator",
379+
"data": "a\uff0eb",
380+
"valid": true
381+
},
382+
{
383+
"description": "halfwidth ideographic full stop as label separator",
384+
"data": "a\uff61b",
385+
"valid": true
339386
}
340387
]
341388
}

0 commit comments

Comments
 (0)