Skip to content

Commit 6e332ca

Browse files
authored
Merge pull request #366 from harrel56/chore/update-test-suite-20260310-155636
chore(test-suite): incremental test suite update from upstream
2 parents bdd4bcf + 82b789a commit 6e332ca

33 files changed

Lines changed: 1033 additions & 81 deletions

File tree

lib/src/testFixtures/java/dev/harrel/jsonschema/SpecificationSuiteTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ Stream<DynamicNode> draft2020Required() {
2020
.withSchemaResolver(createSchemaResolver())
2121
.createValidator();
2222

23-
SuiteTestGenerator generator = new SuiteTestGenerator(new ProviderMapper(getJsonNodeFactory()), validator, Map.of());
23+
SuiteTestGenerator generator = new SuiteTestGenerator(new ProviderMapper(getJsonNodeFactory()), validator, Map.of(
24+
// Unfortunately, java regex does not support \\p{Letter} - \\p{L} would work, but well...
25+
"pattern", Map.of("pattern with Unicode property escape requires unicode mode", Set.of("Digits do not match"))
26+
));
2427
return generator.generate(getTestPath() + "/draft2020-12");
2528
}
2629

lib/src/testFixtures/resources/suite-yaml/tests/draft2019-09/optional/format/ipv4.yml

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
- description: validation of IP addresses
2+
comment: 'RFC 2673, Section 3.2: dotted-quad = decbyte "." decbyte "." decbyte "." decbyte. A ''decbyte'' (1*3DIGIT) restricts semantic values to 0-255, allows leading zeros, and strictly forbids symbols, alpha/hex, whitespace, and non-ASCII characters.'
23
schema:
34
$schema: https://json-schema.org/draft/2019-09/schema
45
format: ipv4
@@ -39,16 +40,67 @@
3940
- description: an IP address as an integer (decimal)
4041
data: "2130706433"
4142
valid: false
42-
- description: invalid leading zeroes, as they are treated as octals
43-
comment: see https://sick.codes/universal-netmask-npm-package-used-by-270000-projects-vulnerable-to-octal-input-data-server-side-request-forgery-remote-file-inclusion-local-file-inclusion-and-more-cve-2021-28918/
44-
data: 087.10.0.1
45-
valid: false
46-
- description: value without leading zero is valid
47-
data: 87.10.0.1
48-
valid: true
4943
- description: invalid non-ASCII '২' (a Bengali 2)
5044
data: 1২7.0.0.1
5145
valid: false
5246
- description: netmask is not a part of ipv4 address
5347
data: 192.168.1.0/24
5448
valid: false
49+
- description: leading whitespace is invalid
50+
data: ' 192.168.0.1'
51+
valid: false
52+
- description: trailing whitespace is invalid
53+
data: '192.168.0.1 '
54+
valid: false
55+
- description: trailing newline is invalid
56+
data: |
57+
192.168.0.1
58+
valid: false
59+
- description: hexadecimal notation is invalid
60+
data: 0x7f.0.0.1
61+
valid: false
62+
- description: octal notation explicit is invalid
63+
data: 0o10.0.0.1
64+
valid: false
65+
- description: empty part (double dot) is invalid
66+
data: 192.168..1
67+
valid: false
68+
- description: leading dot is invalid
69+
data: .192.168.0.1
70+
valid: false
71+
- description: trailing dot is invalid
72+
data: 192.168.0.1.
73+
valid: false
74+
- description: minimum valid IPv4 address
75+
data: 0.0.0.0
76+
valid: true
77+
- description: maximum valid IPv4 address
78+
data: 255.255.255.255
79+
valid: true
80+
- description: empty string is invalid
81+
data: ""
82+
valid: false
83+
- description: plus sign is invalid
84+
data: +1.2.3.4
85+
valid: false
86+
- description: negative sign is invalid
87+
data: -1.2.3.4
88+
valid: false
89+
- description: exponential notation is invalid
90+
data: 1e2.0.0.1
91+
valid: false
92+
- description: alpha characters are invalid
93+
data: 192.168.a.1
94+
valid: false
95+
- description: internal whitespace is invalid
96+
data: 192. 168.0.1
97+
valid: false
98+
- description: tab character is invalid
99+
data: "192.168.0.1\t"
100+
valid: false
101+
- description: with port number is invalid
102+
data: 192.168.0.1:80
103+
valid: false
104+
- description: single octet out of range in last position
105+
data: 192.168.0.256
106+
valid: false

lib/src/testFixtures/resources/suite-yaml/tests/draft2019-09/optional/format/uri-reference.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,11 @@
4848
- description: invalid backslash character
4949
data: https://example.org/foobar\.txt
5050
valid: false
51+
- description: URI with leading-zero IPv4 is structurally valid as a reg-name
52+
comment: 'RFC 3986, Section 3.2.2: If an IP literal fails strict IPv4address parsing, it falls back to reg-name. A string of digits and dots is valid under unreserved characters. JSON Schema format asserts syntax, not scheme-specific DNS semantics.'
53+
data: http://087.10.0.1/
54+
valid: true
55+
- description: URI with out-of-bounds IPv4 is structurally valid as a reg-name
56+
comment: 'RFC 3986, Section 3.2.2: Fallback to reg-name allows digits and dots.'
57+
data: http://999.999.999.999/
58+
valid: true

lib/src/testFixtures/resources/suite-yaml/tests/draft2019-09/optional/format/uri.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,11 @@
111111
- description: invalid | character
112112
data: https://example.org/foobar|.txt
113113
valid: false
114+
- description: URI with leading-zero IPv4 is structurally valid as a reg-name
115+
comment: 'RFC 3986, Section 3.2.2: If an IP literal fails strict IPv4address parsing, it falls back to reg-name. A string of digits and dots is valid under unreserved characters. JSON Schema format asserts syntax, not scheme-specific DNS semantics.'
116+
data: http://087.10.0.1/
117+
valid: true
118+
- description: URI with out-of-bounds IPv4 is structurally valid as a reg-name
119+
comment: 'RFC 3986, Section 3.2.2: Fallback to reg-name allows digits and dots.'
120+
data: http://999.999.999.999/
121+
valid: true

lib/src/testFixtures/resources/suite-yaml/tests/draft2020-12/optional/format/ipv4.yml

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
- description: validation of IP addresses
2+
comment: 'RFC 2673, Section 3.2: dotted-quad = decbyte "." decbyte "." decbyte "." decbyte. A ''decbyte'' (1*3DIGIT) restricts semantic values to 0-255, allows leading zeros, and strictly forbids symbols, alpha/hex, whitespace, and non-ASCII characters.'
23
schema:
34
$schema: https://json-schema.org/draft/2020-12/schema
45
format: ipv4
@@ -39,16 +40,67 @@
3940
- description: an IP address as an integer (decimal)
4041
data: "2130706433"
4142
valid: false
42-
- description: invalid leading zeroes, as they are treated as octals
43-
comment: see https://sick.codes/universal-netmask-npm-package-used-by-270000-projects-vulnerable-to-octal-input-data-server-side-request-forgery-remote-file-inclusion-local-file-inclusion-and-more-cve-2021-28918/
44-
data: 087.10.0.1
45-
valid: false
46-
- description: value without leading zero is valid
47-
data: 87.10.0.1
48-
valid: true
4943
- description: invalid non-ASCII '২' (a Bengali 2)
5044
data: 1২7.0.0.1
5145
valid: false
5246
- description: netmask is not a part of ipv4 address
5347
data: 192.168.1.0/24
5448
valid: false
49+
- description: leading whitespace is invalid
50+
data: ' 192.168.0.1'
51+
valid: false
52+
- description: trailing whitespace is invalid
53+
data: '192.168.0.1 '
54+
valid: false
55+
- description: trailing newline is invalid
56+
data: |
57+
192.168.0.1
58+
valid: false
59+
- description: hexadecimal notation is invalid
60+
data: 0x7f.0.0.1
61+
valid: false
62+
- description: octal notation explicit is invalid
63+
data: 0o10.0.0.1
64+
valid: false
65+
- description: empty part (double dot) is invalid
66+
data: 192.168..1
67+
valid: false
68+
- description: leading dot is invalid
69+
data: .192.168.0.1
70+
valid: false
71+
- description: trailing dot is invalid
72+
data: 192.168.0.1.
73+
valid: false
74+
- description: minimum valid IPv4 address
75+
data: 0.0.0.0
76+
valid: true
77+
- description: maximum valid IPv4 address
78+
data: 255.255.255.255
79+
valid: true
80+
- description: empty string is invalid
81+
data: ""
82+
valid: false
83+
- description: plus sign is invalid
84+
data: +1.2.3.4
85+
valid: false
86+
- description: negative sign is invalid
87+
data: -1.2.3.4
88+
valid: false
89+
- description: exponential notation is invalid
90+
data: 1e2.0.0.1
91+
valid: false
92+
- description: alpha characters are invalid
93+
data: 192.168.a.1
94+
valid: false
95+
- description: internal whitespace is invalid
96+
data: 192. 168.0.1
97+
valid: false
98+
- description: tab character is invalid
99+
data: "192.168.0.1\t"
100+
valid: false
101+
- description: with port number is invalid
102+
data: 192.168.0.1:80
103+
valid: false
104+
- description: single octet out of range in last position
105+
data: 192.168.0.256
106+
valid: false

lib/src/testFixtures/resources/suite-yaml/tests/draft2020-12/optional/format/uri-reference.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,11 @@
4848
- description: invalid backslash character
4949
data: https://example.org/foobar\.txt
5050
valid: false
51+
- description: URI with leading-zero IPv4 is structurally valid as a reg-name
52+
comment: 'RFC 3986, Section 3.2.2: If an IP literal fails strict IPv4address parsing, it falls back to reg-name. A string of digits and dots is valid under unreserved characters. JSON Schema format asserts syntax, not scheme-specific DNS semantics.'
53+
data: http://087.10.0.1/
54+
valid: true
55+
- description: URI with out-of-bounds IPv4 is structurally valid as a reg-name
56+
comment: 'RFC 3986, Section 3.2.2: Fallback to reg-name allows digits and dots.'
57+
data: http://999.999.999.999/
58+
valid: true

lib/src/testFixtures/resources/suite-yaml/tests/draft2020-12/optional/format/uri.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,11 @@
111111
- description: invalid | character
112112
data: https://example.org/foobar|.txt
113113
valid: false
114+
- description: URI with leading-zero IPv4 is structurally valid as a reg-name
115+
comment: 'RFC 3986, Section 3.2.2: If an IP literal fails strict IPv4address parsing, it falls back to reg-name. A string of digits and dots is valid under unreserved characters. JSON Schema format asserts syntax, not scheme-specific DNS semantics.'
116+
data: http://087.10.0.1/
117+
valid: true
118+
- description: URI with out-of-bounds IPv4 is structurally valid as a reg-name
119+
comment: 'RFC 3986, Section 3.2.2: Fallback to reg-name allows digits and dots.'
120+
data: http://999.999.999.999/
121+
valid: true

lib/src/testFixtures/resources/suite-yaml/tests/draft2020-12/pattern.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,18 @@
3535
- description: matches a substring
3636
data: xxaayy
3737
valid: true
38+
- description: pattern with Unicode property escape requires unicode mode
39+
schema:
40+
$schema: https://json-schema.org/draft/2020-12/schema
41+
type: string
42+
pattern: ^\p{Letter}+$
43+
tests:
44+
- description: ASCII letters match
45+
data: Hello
46+
valid: true
47+
- description: Non-ASCII letters match
48+
data: π
49+
valid: true
50+
- description: Digits do not match
51+
data: "123"
52+
valid: false

lib/src/testFixtures/resources/suite-yaml/tests/draft2020-12/patternProperties.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,19 @@
132132
data:
133133
foobar: null
134134
valid: true
135+
- description: patternProperties with Unicode property escape
136+
schema:
137+
$schema: https://json-schema.org/draft/2020-12/schema
138+
type: object
139+
patternProperties:
140+
^\p{Letter}+$:
141+
type: number
142+
tests:
143+
- description: Unicode letter property name matches
144+
data:
145+
π: 1
146+
valid: true
147+
- description: Non-letter property name does not match pattern
148+
data:
149+
"123": 1
150+
valid: true

lib/src/testFixtures/resources/suite-yaml/tests/draft4/optional/format/ipv4.yml

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
- description: validation of IP addresses
2+
comment: 'RFC 2673, Section 3.2: dotted-quad = decbyte "." decbyte "." decbyte "." decbyte. A ''decbyte'' (1*3DIGIT) restricts semantic values to 0-255, allows leading zeros, and strictly forbids symbols, alpha/hex, whitespace, and non-ASCII characters.'
23
schema:
34
format: ipv4
45
tests:
@@ -38,16 +39,67 @@
3839
- description: an IP address as an integer (decimal)
3940
data: "2130706433"
4041
valid: false
41-
- description: invalid leading zeroes, as they are treated as octals
42-
comment: see https://sick.codes/universal-netmask-npm-package-used-by-270000-projects-vulnerable-to-octal-input-data-server-side-request-forgery-remote-file-inclusion-local-file-inclusion-and-more-cve-2021-28918/
43-
data: 087.10.0.1
44-
valid: false
45-
- description: value without leading zero is valid
46-
data: 87.10.0.1
47-
valid: true
4842
- description: invalid non-ASCII '২' (a Bengali 2)
4943
data: 1২7.0.0.1
5044
valid: false
5145
- description: netmask is not a part of ipv4 address
5246
data: 192.168.1.0/24
5347
valid: false
48+
- description: leading whitespace is invalid
49+
data: ' 192.168.0.1'
50+
valid: false
51+
- description: trailing whitespace is invalid
52+
data: '192.168.0.1 '
53+
valid: false
54+
- description: trailing newline is invalid
55+
data: |
56+
192.168.0.1
57+
valid: false
58+
- description: hexadecimal notation is invalid
59+
data: 0x7f.0.0.1
60+
valid: false
61+
- description: octal notation explicit is invalid
62+
data: 0o10.0.0.1
63+
valid: false
64+
- description: empty part (double dot) is invalid
65+
data: 192.168..1
66+
valid: false
67+
- description: leading dot is invalid
68+
data: .192.168.0.1
69+
valid: false
70+
- description: trailing dot is invalid
71+
data: 192.168.0.1.
72+
valid: false
73+
- description: minimum valid IPv4 address
74+
data: 0.0.0.0
75+
valid: true
76+
- description: maximum valid IPv4 address
77+
data: 255.255.255.255
78+
valid: true
79+
- description: empty string is invalid
80+
data: ""
81+
valid: false
82+
- description: plus sign is invalid
83+
data: +1.2.3.4
84+
valid: false
85+
- description: negative sign is invalid
86+
data: -1.2.3.4
87+
valid: false
88+
- description: exponential notation is invalid
89+
data: 1e2.0.0.1
90+
valid: false
91+
- description: alpha characters are invalid
92+
data: 192.168.a.1
93+
valid: false
94+
- description: internal whitespace is invalid
95+
data: 192. 168.0.1
96+
valid: false
97+
- description: tab character is invalid
98+
data: "192.168.0.1\t"
99+
valid: false
100+
- description: with port number is invalid
101+
data: 192.168.0.1:80
102+
valid: false
103+
- description: single octet out of range in last position
104+
data: 192.168.0.256
105+
valid: false

0 commit comments

Comments
 (0)