summaryrefslogtreecommitdiff
path: root/json
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2022-04-29 10:03:16 -0400
committerJulian Berman <Julian@GrayVines.com>2022-04-29 10:03:16 -0400
commite71e22d148185feca16dce178c045ea932f172ea (patch)
tree67d01f46d705a51b29401665df13c7f1f17cef31 /json
parent485c805e65e99f318ebcb03aacbcb580c0cbe193 (diff)
parent19d2c1a183eeb2b2f4b07e05545b9e670babf986 (diff)
downloadjsonschema-e71e22d148185feca16dce178c045ea932f172ea.tar.gz
Merge commit '19d2c1a183eeb2b2f4b07e05545b9e670babf986'
* commit '19d2c1a183eeb2b2f4b07e05545b9e670babf986': Squashed 'json/' changes from 3731ed32a..060caae0d
Diffstat (limited to 'json')
-rw-r--r--json/README.md4
-rw-r--r--json/remotes/draft-next/format-assertion-false.json12
-rw-r--r--json/remotes/draft-next/format-assertion-true.json12
-rw-r--r--json/remotes/draft-next/metaschema-no-validation.json11
-rw-r--r--json/tests/draft-next/dynamicRef.json147
-rw-r--r--json/tests/draft-next/optional/format-assertion.json4
-rw-r--r--json/tests/draft-next/optional/format/email.json35
-rw-r--r--json/tests/draft-next/vocabulary.json2
-rw-r--r--json/tests/draft2020-12/optional/format/email.json35
9 files changed, 114 insertions, 148 deletions
diff --git a/json/README.md b/json/README.md
index 016fdd1..b5cd6d5 100644
--- a/json/README.md
+++ b/json/README.md
@@ -199,6 +199,10 @@ which also welcomes your contributions!
* [jsonschema](https://github.com/Stranger6667/jsonschema-rs)
* [valico](https://github.com/rustless/valico)
+### Scala
+
+* [typed-json](https://github.com/frawa/typed-json)
+
### Swift
* [JSONSchema](https://github.com/kylef/JSONSchema.swift)
diff --git a/json/remotes/draft-next/format-assertion-false.json b/json/remotes/draft-next/format-assertion-false.json
new file mode 100644
index 0000000..1a55fed
--- /dev/null
+++ b/json/remotes/draft-next/format-assertion-false.json
@@ -0,0 +1,12 @@
+{
+ "$id": "http://localhost:1234/draft-next/format-assertion-false.json",
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "$vocabulary": {
+ "https://json-schema.org/draft/next/vocab/core": true,
+ "https://json-schema.org/draft/next/vocab/format-assertion": false
+ },
+ "allOf": [
+ { "$ref": "https://json-schema.org/draft/next/schema/meta/core" },
+ { "$ref": "https://json-schema.org/draft/next/schema/meta/format-assertion" }
+ ]
+}
diff --git a/json/remotes/draft-next/format-assertion-true.json b/json/remotes/draft-next/format-assertion-true.json
new file mode 100644
index 0000000..5862dfe
--- /dev/null
+++ b/json/remotes/draft-next/format-assertion-true.json
@@ -0,0 +1,12 @@
+{
+ "$id": "http://localhost:1234/draft-next/format-assertion-true.json",
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "$vocabulary": {
+ "https://json-schema.org/draft/next/vocab/core": true,
+ "https://json-schema.org/draft/next/vocab/format-assertion": true
+ },
+ "allOf": [
+ { "$ref": "https://json-schema.org/draft/next/schema/meta/core" },
+ { "$ref": "https://json-schema.org/draft/next/schema/meta/format-assertion" }
+ ]
+}
diff --git a/json/remotes/draft-next/metaschema-no-validation.json b/json/remotes/draft-next/metaschema-no-validation.json
new file mode 100644
index 0000000..2b50c05
--- /dev/null
+++ b/json/remotes/draft-next/metaschema-no-validation.json
@@ -0,0 +1,11 @@
+{
+ "$id": "http://localhost:1234/draft-next/metaschema-no-validation.json",
+ "$vocabulary": {
+ "https://json-schema.org/draft/next/vocab/applicator": true,
+ "https://json-schema.org/draft/next/vocab/core": true
+ },
+ "allOf": [
+ { "$ref": "https://json-schema.org/draft/next/meta/applicator" },
+ { "$ref": "https://json-schema.org/draft/next/meta/core" }
+ ]
+}
diff --git a/json/tests/draft-next/dynamicRef.json b/json/tests/draft-next/dynamicRef.json
index 618d836..d022856 100644
--- a/json/tests/draft-next/dynamicRef.json
+++ b/json/tests/draft-next/dynamicRef.json
@@ -26,32 +26,6 @@
]
},
{
- "description": "A $dynamicRef to an $anchor in the same schema resource should behave like a normal $ref to an $anchor",
- "schema": {
- "$id": "https://test.json-schema.org/dynamicRef-anchor-same-schema/root",
- "type": "array",
- "items": { "$dynamicRef": "#items" },
- "$defs": {
- "foo": {
- "$anchor": "items",
- "type": "string"
- }
- }
- },
- "tests": [
- {
- "description": "An array of strings is valid",
- "data": ["foo", "bar"],
- "valid": true
- },
- {
- "description": "An array containing non-strings is invalid",
- "data": ["foo", 42],
- "valid": false
- }
- ]
- },
- {
"description": "A $ref to a $dynamicAnchor in the same schema resource should behave like a normal $ref to an $anchor",
"schema": {
"$id": "https://test.json-schema.org/ref-dynamicAnchor-same-schema/root",
@@ -90,13 +64,7 @@
"list": {
"$id": "list",
"type": "array",
- "items": { "$dynamicRef": "#items" },
- "$defs": {
- "items": {
- "$comment": "This is only needed to satisfy the bookending requirement",
- "$dynamicAnchor": "items"
- }
- }
+ "items": { "$dynamicRef": "#items" }
}
}
},
@@ -130,13 +98,7 @@
"list": {
"$id": "list",
"type": "array",
- "items": { "$dynamicRef": "#items" },
- "$defs": {
- "items": {
- "$comment": "This is only needed to satisfy the bookending requirement",
- "$dynamicAnchor": "items"
- }
- }
+ "items": { "$dynamicRef": "#items" }
}
}
},
@@ -169,7 +131,6 @@
"items": { "$dynamicRef": "#items" },
"$defs": {
"items": {
- "$comment": "This is only needed to satisfy the bookending requirement",
"$dynamicAnchor": "items"
}
}
@@ -185,69 +146,6 @@
]
},
{
- "description": "A $dynamicRef without a matching $dynamicAnchor in the same schema resource should behave like a normal $ref to $anchor",
- "schema": {
- "$id": "https://test.json-schema.org/dynamic-resolution-without-bookend/root",
- "$ref": "list",
- "$defs": {
- "foo": {
- "$dynamicAnchor": "items",
- "type": "string"
- },
- "list": {
- "$id": "list",
- "type": "array",
- "items": { "$dynamicRef": "#items" },
- "$defs": {
- "items": {
- "$comment": "This is only needed to give the reference somewhere to resolve to when it behaves like $ref",
- "$anchor": "items"
- }
- }
- }
- }
- },
- "tests": [
- {
- "description": "Any array is valid",
- "data": ["foo", 42],
- "valid": true
- }
- ]
- },
- {
- "description": "A $dynamicRef with a non-matching $dynamicAnchor in the same schema resource should behave like a normal $ref to $anchor",
- "schema": {
- "$id": "https://test.json-schema.org/unmatched-dynamic-anchor/root",
- "$ref": "list",
- "$defs": {
- "foo": {
- "$dynamicAnchor": "items",
- "type": "string"
- },
- "list": {
- "$id": "list",
- "type": "array",
- "items": { "$dynamicRef": "#items" },
- "$defs": {
- "items": {
- "$comment": "This is only needed to give the reference somewhere to resolve to when it behaves like $ref",
- "$anchor": "items",
- "$dynamicAnchor": "foo"
- }
- }
- }
- }
- },
- "tests": [
- {
- "description": "Any array is valid",
- "data": ["foo", 42],
- "valid": true
- }
- ]
- },
- {
"description": "A $dynamicRef that initially resolves to a schema with a matching $dynamicAnchor should resolve to the first $dynamicAnchor in the dynamic scope",
"schema": {
"$id": "https://test.json-schema.org/relative-dynamic-reference/root",
@@ -299,47 +197,6 @@
]
},
{
- "description": "A $dynamicRef that initially resolves to a schema without a matching $dynamicAnchor should behave like a normal $ref to $anchor",
- "schema": {
- "$id": "https://test.json-schema.org/relative-dynamic-reference-without-bookend/root",
- "$dynamicAnchor": "meta",
- "type": "object",
- "properties": {
- "foo": { "const": "pass" }
- },
- "$ref": "extended",
- "$defs": {
- "extended": {
- "$id": "extended",
- "$anchor": "meta",
- "type": "object",
- "properties": {
- "bar": { "$ref": "bar" }
- }
- },
- "bar": {
- "$id": "bar",
- "type": "object",
- "properties": {
- "baz": { "$dynamicRef": "extended#meta" }
- }
- }
- }
- },
- "tests": [
- {
- "description": "The recursive part doesn't need to validate against the root",
- "data": {
- "foo": "pass",
- "bar": {
- "baz": { "foo": "fail" }
- }
- },
- "valid": true
- }
- ]
- },
- {
"description": "multiple dynamic paths to the $dynamicRef keyword",
"schema": {
"$id": "https://test.json-schema.org/dynamic-ref-with-multiple-paths/main",
diff --git a/json/tests/draft-next/optional/format-assertion.json b/json/tests/draft-next/optional/format-assertion.json
index 0340037..ede922a 100644
--- a/json/tests/draft-next/optional/format-assertion.json
+++ b/json/tests/draft-next/optional/format-assertion.json
@@ -3,7 +3,7 @@
"description": "schema that uses custom metaschema with format-assertion: false",
"schema": {
"$id": "https://schema/using/format-assertion/false",
- "$schema": "http://localhost:1234/draft2020-12/format-assertion-false.json",
+ "$schema": "http://localhost:1234/draft-next/format-assertion-false.json",
"format": "ipv4"
},
"tests": [
@@ -23,7 +23,7 @@
"description": "schema that uses custom metaschema with format-assertion: true",
"schema": {
"$id": "https://schema/using/format-assertion/true",
- "$schema": "http://localhost:1234/draft2020-12/format-assertion-true.json",
+ "$schema": "http://localhost:1234/draft-next/format-assertion-true.json",
"format": "ipv4"
},
"tests": [
diff --git a/json/tests/draft-next/optional/format/email.json b/json/tests/draft-next/optional/format/email.json
index d6761a4..5ce1c70 100644
--- a/json/tests/draft-next/optional/format/email.json
+++ b/json/tests/draft-next/optional/format/email.json
@@ -59,6 +59,31 @@
"valid": true
},
{
+ "description": "a quoted string with a space in the local part is valid",
+ "data": "\"joe bloggs\"@example.com",
+ "valid": true
+ },
+ {
+ "description": "a quoted string with a double dot in the local part is valid",
+ "data": "\"joe..bloggs\"@example.com",
+ "valid": true
+ },
+ {
+ "description": "a quoted string with a @ in the local part is valid",
+ "data": "\"joe@bloggs\"@example.com",
+ "valid": true
+ },
+ {
+ "description": "an IPv4-address-literal after the @ is valid",
+ "data": "joe.bloggs@[127.0.0.1]",
+ "valid": true
+ },
+ {
+ "description": "an IPv6-address-literal after the @ is valid",
+ "data": "joe.bloggs@[IPv6:::1]",
+ "valid": true
+ },
+ {
"description": "dot before local part is not valid",
"data": ".test@example.com",
"valid": false
@@ -77,6 +102,16 @@
"description": "two subsequent dots inside local part are not valid",
"data": "te..st@example.com",
"valid": false
+ },
+ {
+ "description": "an invalid domain",
+ "data": "joe.bloggs@invalid=domain.com",
+ "valid": false
+ },
+ {
+ "description": "an invalid IPv4-address-literal",
+ "data": "joe.bloggs@[127.0.0.300]",
+ "valid": false
}
]
}
diff --git a/json/tests/draft-next/vocabulary.json b/json/tests/draft-next/vocabulary.json
index d84f8f1..65b81ea 100644
--- a/json/tests/draft-next/vocabulary.json
+++ b/json/tests/draft-next/vocabulary.json
@@ -3,7 +3,7 @@
"description": "schema that uses custom metaschema with with no validation vocabulary",
"schema": {
"$id": "https://schema/using/no/validation",
- "$schema": "http://localhost:1234/draft2020-12/metaschema-no-validation.json",
+ "$schema": "http://localhost:1234/draft-next/metaschema-no-validation.json",
"properties": {
"badProperty": false,
"numberProperty": {
diff --git a/json/tests/draft2020-12/optional/format/email.json b/json/tests/draft2020-12/optional/format/email.json
index d6761a4..5ce1c70 100644
--- a/json/tests/draft2020-12/optional/format/email.json
+++ b/json/tests/draft2020-12/optional/format/email.json
@@ -59,6 +59,31 @@
"valid": true
},
{
+ "description": "a quoted string with a space in the local part is valid",
+ "data": "\"joe bloggs\"@example.com",
+ "valid": true
+ },
+ {
+ "description": "a quoted string with a double dot in the local part is valid",
+ "data": "\"joe..bloggs\"@example.com",
+ "valid": true
+ },
+ {
+ "description": "a quoted string with a @ in the local part is valid",
+ "data": "\"joe@bloggs\"@example.com",
+ "valid": true
+ },
+ {
+ "description": "an IPv4-address-literal after the @ is valid",
+ "data": "joe.bloggs@[127.0.0.1]",
+ "valid": true
+ },
+ {
+ "description": "an IPv6-address-literal after the @ is valid",
+ "data": "joe.bloggs@[IPv6:::1]",
+ "valid": true
+ },
+ {
"description": "dot before local part is not valid",
"data": ".test@example.com",
"valid": false
@@ -77,6 +102,16 @@
"description": "two subsequent dots inside local part are not valid",
"data": "te..st@example.com",
"valid": false
+ },
+ {
+ "description": "an invalid domain",
+ "data": "joe.bloggs@invalid=domain.com",
+ "valid": false
+ },
+ {
+ "description": "an invalid IPv4-address-literal",
+ "data": "joe.bloggs@[127.0.0.300]",
+ "valid": false
}
]
}