Skip to content

Commit e71e22d

Browse files
committed
Merge commit '19d2c1a183eeb2b2f4b07e05545b9e670babf986'
* commit '19d2c1a183eeb2b2f4b07e05545b9e670babf986': Squashed 'json/' changes from 3731ed32a..060caae0d
2 parents 485c805 + 19d2c1a commit e71e22d

File tree

9 files changed

+114
-148
lines changed

9 files changed

+114
-148
lines changed

json/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ which also welcomes your contributions!
199199
* [jsonschema](https://github.com/Stranger6667/jsonschema-rs)
200200
* [valico](https://github.com/rustless/valico)
201201

202+
### Scala
203+
204+
* [typed-json](https://github.com/frawa/typed-json)
205+
202206
### Swift
203207

204208
* [JSONSchema](https://github.com/kylef/JSONSchema.swift)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$id": "http://localhost:1234/draft-next/format-assertion-false.json",
3+
"$schema": "https://json-schema.org/draft/next/schema",
4+
"$vocabulary": {
5+
"https://json-schema.org/draft/next/vocab/core": true,
6+
"https://json-schema.org/draft/next/vocab/format-assertion": false
7+
},
8+
"allOf": [
9+
{ "$ref": "https://json-schema.org/draft/next/schema/meta/core" },
10+
{ "$ref": "https://json-schema.org/draft/next/schema/meta/format-assertion" }
11+
]
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$id": "http://localhost:1234/draft-next/format-assertion-true.json",
3+
"$schema": "https://json-schema.org/draft/next/schema",
4+
"$vocabulary": {
5+
"https://json-schema.org/draft/next/vocab/core": true,
6+
"https://json-schema.org/draft/next/vocab/format-assertion": true
7+
},
8+
"allOf": [
9+
{ "$ref": "https://json-schema.org/draft/next/schema/meta/core" },
10+
{ "$ref": "https://json-schema.org/draft/next/schema/meta/format-assertion" }
11+
]
12+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$id": "http://localhost:1234/draft-next/metaschema-no-validation.json",
3+
"$vocabulary": {
4+
"https://json-schema.org/draft/next/vocab/applicator": true,
5+
"https://json-schema.org/draft/next/vocab/core": true
6+
},
7+
"allOf": [
8+
{ "$ref": "https://json-schema.org/draft/next/meta/applicator" },
9+
{ "$ref": "https://json-schema.org/draft/next/meta/core" }
10+
]
11+
}

json/tests/draft-next/dynamicRef.json

Lines changed: 2 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,6 @@
2525
}
2626
]
2727
},
28-
{
29-
"description": "A $dynamicRef to an $anchor in the same schema resource should behave like a normal $ref to an $anchor",
30-
"schema": {
31-
"$id": "https://test.json-schema.org/dynamicRef-anchor-same-schema/root",
32-
"type": "array",
33-
"items": { "$dynamicRef": "#items" },
34-
"$defs": {
35-
"foo": {
36-
"$anchor": "items",
37-
"type": "string"
38-
}
39-
}
40-
},
41-
"tests": [
42-
{
43-
"description": "An array of strings is valid",
44-
"data": ["foo", "bar"],
45-
"valid": true
46-
},
47-
{
48-
"description": "An array containing non-strings is invalid",
49-
"data": ["foo", 42],
50-
"valid": false
51-
}
52-
]
53-
},
5428
{
5529
"description": "A $ref to a $dynamicAnchor in the same schema resource should behave like a normal $ref to an $anchor",
5630
"schema": {
@@ -90,13 +64,7 @@
9064
"list": {
9165
"$id": "list",
9266
"type": "array",
93-
"items": { "$dynamicRef": "#items" },
94-
"$defs": {
95-
"items": {
96-
"$comment": "This is only needed to satisfy the bookending requirement",
97-
"$dynamicAnchor": "items"
98-
}
99-
}
67+
"items": { "$dynamicRef": "#items" }
10068
}
10169
}
10270
},
@@ -130,13 +98,7 @@
13098
"list": {
13199
"$id": "list",
132100
"type": "array",
133-
"items": { "$dynamicRef": "#items" },
134-
"$defs": {
135-
"items": {
136-
"$comment": "This is only needed to satisfy the bookending requirement",
137-
"$dynamicAnchor": "items"
138-
}
139-
}
101+
"items": { "$dynamicRef": "#items" }
140102
}
141103
}
142104
},
@@ -169,7 +131,6 @@
169131
"items": { "$dynamicRef": "#items" },
170132
"$defs": {
171133
"items": {
172-
"$comment": "This is only needed to satisfy the bookending requirement",
173134
"$dynamicAnchor": "items"
174135
}
175136
}
@@ -184,69 +145,6 @@
184145
}
185146
]
186147
},
187-
{
188-
"description": "A $dynamicRef without a matching $dynamicAnchor in the same schema resource should behave like a normal $ref to $anchor",
189-
"schema": {
190-
"$id": "https://test.json-schema.org/dynamic-resolution-without-bookend/root",
191-
"$ref": "list",
192-
"$defs": {
193-
"foo": {
194-
"$dynamicAnchor": "items",
195-
"type": "string"
196-
},
197-
"list": {
198-
"$id": "list",
199-
"type": "array",
200-
"items": { "$dynamicRef": "#items" },
201-
"$defs": {
202-
"items": {
203-
"$comment": "This is only needed to give the reference somewhere to resolve to when it behaves like $ref",
204-
"$anchor": "items"
205-
}
206-
}
207-
}
208-
}
209-
},
210-
"tests": [
211-
{
212-
"description": "Any array is valid",
213-
"data": ["foo", 42],
214-
"valid": true
215-
}
216-
]
217-
},
218-
{
219-
"description": "A $dynamicRef with a non-matching $dynamicAnchor in the same schema resource should behave like a normal $ref to $anchor",
220-
"schema": {
221-
"$id": "https://test.json-schema.org/unmatched-dynamic-anchor/root",
222-
"$ref": "list",
223-
"$defs": {
224-
"foo": {
225-
"$dynamicAnchor": "items",
226-
"type": "string"
227-
},
228-
"list": {
229-
"$id": "list",
230-
"type": "array",
231-
"items": { "$dynamicRef": "#items" },
232-
"$defs": {
233-
"items": {
234-
"$comment": "This is only needed to give the reference somewhere to resolve to when it behaves like $ref",
235-
"$anchor": "items",
236-
"$dynamicAnchor": "foo"
237-
}
238-
}
239-
}
240-
}
241-
},
242-
"tests": [
243-
{
244-
"description": "Any array is valid",
245-
"data": ["foo", 42],
246-
"valid": true
247-
}
248-
]
249-
},
250148
{
251149
"description": "A $dynamicRef that initially resolves to a schema with a matching $dynamicAnchor should resolve to the first $dynamicAnchor in the dynamic scope",
252150
"schema": {
@@ -298,47 +196,6 @@
298196
}
299197
]
300198
},
301-
{
302-
"description": "A $dynamicRef that initially resolves to a schema without a matching $dynamicAnchor should behave like a normal $ref to $anchor",
303-
"schema": {
304-
"$id": "https://test.json-schema.org/relative-dynamic-reference-without-bookend/root",
305-
"$dynamicAnchor": "meta",
306-
"type": "object",
307-
"properties": {
308-
"foo": { "const": "pass" }
309-
},
310-
"$ref": "extended",
311-
"$defs": {
312-
"extended": {
313-
"$id": "extended",
314-
"$anchor": "meta",
315-
"type": "object",
316-
"properties": {
317-
"bar": { "$ref": "bar" }
318-
}
319-
},
320-
"bar": {
321-
"$id": "bar",
322-
"type": "object",
323-
"properties": {
324-
"baz": { "$dynamicRef": "extended#meta" }
325-
}
326-
}
327-
}
328-
},
329-
"tests": [
330-
{
331-
"description": "The recursive part doesn't need to validate against the root",
332-
"data": {
333-
"foo": "pass",
334-
"bar": {
335-
"baz": { "foo": "fail" }
336-
}
337-
},
338-
"valid": true
339-
}
340-
]
341-
},
342199
{
343200
"description": "multiple dynamic paths to the $dynamicRef keyword",
344201
"schema": {

json/tests/draft-next/optional/format-assertion.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "schema that uses custom metaschema with format-assertion: false",
44
"schema": {
55
"$id": "https://schema/using/format-assertion/false",
6-
"$schema": "http://localhost:1234/draft2020-12/format-assertion-false.json",
6+
"$schema": "http://localhost:1234/draft-next/format-assertion-false.json",
77
"format": "ipv4"
88
},
99
"tests": [
@@ -23,7 +23,7 @@
2323
"description": "schema that uses custom metaschema with format-assertion: true",
2424
"schema": {
2525
"$id": "https://schema/using/format-assertion/true",
26-
"$schema": "http://localhost:1234/draft2020-12/format-assertion-true.json",
26+
"$schema": "http://localhost:1234/draft-next/format-assertion-true.json",
2727
"format": "ipv4"
2828
},
2929
"tests": [

json/tests/draft-next/optional/format/email.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,31 @@
5858
"data": "[email protected]",
5959
"valid": true
6060
},
61+
{
62+
"description": "a quoted string with a space in the local part is valid",
63+
"data": "\"joe bloggs\"@example.com",
64+
"valid": true
65+
},
66+
{
67+
"description": "a quoted string with a double dot in the local part is valid",
68+
"data": "\"joe..bloggs\"@example.com",
69+
"valid": true
70+
},
71+
{
72+
"description": "a quoted string with a @ in the local part is valid",
73+
"data": "\"joe@bloggs\"@example.com",
74+
"valid": true
75+
},
76+
{
77+
"description": "an IPv4-address-literal after the @ is valid",
78+
"data": "joe.bloggs@[127.0.0.1]",
79+
"valid": true
80+
},
81+
{
82+
"description": "an IPv6-address-literal after the @ is valid",
83+
"data": "joe.bloggs@[IPv6:::1]",
84+
"valid": true
85+
},
6186
{
6287
"description": "dot before local part is not valid",
6388
"data": "[email protected]",
@@ -77,6 +102,16 @@
77102
"description": "two subsequent dots inside local part are not valid",
78103
"data": "[email protected]",
79104
"valid": false
105+
},
106+
{
107+
"description": "an invalid domain",
108+
"data": "joe.bloggs@invalid=domain.com",
109+
"valid": false
110+
},
111+
{
112+
"description": "an invalid IPv4-address-literal",
113+
"data": "joe.bloggs@[127.0.0.300]",
114+
"valid": false
80115
}
81116
]
82117
}

json/tests/draft-next/vocabulary.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "schema that uses custom metaschema with with no validation vocabulary",
44
"schema": {
55
"$id": "https://schema/using/no/validation",
6-
"$schema": "http://localhost:1234/draft2020-12/metaschema-no-validation.json",
6+
"$schema": "http://localhost:1234/draft-next/metaschema-no-validation.json",
77
"properties": {
88
"badProperty": false,
99
"numberProperty": {

json/tests/draft2020-12/optional/format/email.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,31 @@
5858
"data": "[email protected]",
5959
"valid": true
6060
},
61+
{
62+
"description": "a quoted string with a space in the local part is valid",
63+
"data": "\"joe bloggs\"@example.com",
64+
"valid": true
65+
},
66+
{
67+
"description": "a quoted string with a double dot in the local part is valid",
68+
"data": "\"joe..bloggs\"@example.com",
69+
"valid": true
70+
},
71+
{
72+
"description": "a quoted string with a @ in the local part is valid",
73+
"data": "\"joe@bloggs\"@example.com",
74+
"valid": true
75+
},
76+
{
77+
"description": "an IPv4-address-literal after the @ is valid",
78+
"data": "joe.bloggs@[127.0.0.1]",
79+
"valid": true
80+
},
81+
{
82+
"description": "an IPv6-address-literal after the @ is valid",
83+
"data": "joe.bloggs@[IPv6:::1]",
84+
"valid": true
85+
},
6186
{
6287
"description": "dot before local part is not valid",
6388
"data": "[email protected]",
@@ -77,6 +102,16 @@
77102
"description": "two subsequent dots inside local part are not valid",
78103
"data": "[email protected]",
79104
"valid": false
105+
},
106+
{
107+
"description": "an invalid domain",
108+
"data": "joe.bloggs@invalid=domain.com",
109+
"valid": false
110+
},
111+
{
112+
"description": "an invalid IPv4-address-literal",
113+
"data": "joe.bloggs@[127.0.0.300]",
114+
"valid": false
80115
}
81116
]
82117
}

0 commit comments

Comments
 (0)