summaryrefslogtreecommitdiff
path: root/json
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2022-11-28 11:14:13 -0500
committerJulian Berman <Julian@GrayVines.com>2022-11-28 11:14:13 -0500
commitfb203a5736208b837c155161b4af48212486c154 (patch)
tree87aa8f656b4666d980348e1151fbcee2beed6823 /json
parent46fdb982a26aac211bc4d20b2ef6d8089a520f77 (diff)
parent97954adeb0fbb3d4499580d897de507d3ab0d919 (diff)
downloadjsonschema-fb203a5736208b837c155161b4af48212486c154.tar.gz
Merge commit '97954adeb0fbb3d4499580d897de507d3ab0d919'
* commit '97954adeb0fbb3d4499580d897de507d3ab0d919': Squashed 'json/' changes from 9251ebff1..78c888273
Diffstat (limited to 'json')
-rw-r--r--json/README.md2
-rw-r--r--json/remotes/draft-next/locationIndependentIdentifierDraft4.json12
-rw-r--r--json/remotes/draft-next/locationIndependentIdentifierPre2019.json12
-rw-r--r--json/remotes/draft-next/name.json16
-rw-r--r--json/remotes/draft-next/ref-and-definitions.json12
-rw-r--r--json/remotes/draft2019-09/locationIndependentIdentifierDraft4.json12
-rw-r--r--json/remotes/draft2019-09/locationIndependentIdentifierPre2019.json12
-rw-r--r--json/remotes/draft2019-09/name.json16
-rw-r--r--json/remotes/draft2019-09/ref-and-definitions.json12
-rw-r--r--json/remotes/draft2020-12/locationIndependentIdentifierDraft4.json12
-rw-r--r--json/remotes/draft2020-12/locationIndependentIdentifierPre2019.json12
-rw-r--r--json/remotes/draft2020-12/name.json16
-rw-r--r--json/remotes/draft2020-12/ref-and-definitions.json12
-rw-r--r--json/tests/draft-next/content.json2
-rw-r--r--json/tests/draft-next/dynamicRef.json89
-rw-r--r--json/tests/draft-next/optional/format/duration.json5
-rw-r--r--json/tests/draft-next/optional/format/relative-json-pointer.json15
-rw-r--r--json/tests/draft-next/optional/format/time.json15
-rw-r--r--json/tests/draft-next/optional/format/uri.json30
-rw-r--r--json/tests/draft-next/optional/format/uuid.json30
-rw-r--r--json/tests/draft-next/unevaluatedProperties.json41
-rw-r--r--json/tests/draft2019-09/content.json2
-rw-r--r--json/tests/draft2019-09/optional/format/duration.json5
-rw-r--r--json/tests/draft2019-09/optional/format/relative-json-pointer.json15
-rw-r--r--json/tests/draft2019-09/optional/format/time.json15
-rw-r--r--json/tests/draft2019-09/optional/format/uri.json30
-rw-r--r--json/tests/draft2019-09/optional/format/uuid.json30
-rw-r--r--json/tests/draft2020-12/content.json2
-rw-r--r--json/tests/draft2020-12/optional/format/duration.json5
-rw-r--r--json/tests/draft2020-12/optional/format/relative-json-pointer.json15
-rw-r--r--json/tests/draft2020-12/optional/format/time.json15
-rw-r--r--json/tests/draft2020-12/optional/format/uri.json30
-rw-r--r--json/tests/draft2020-12/optional/format/uuid.json30
-rw-r--r--json/tests/draft4/optional/format/uri.json30
-rw-r--r--json/tests/draft6/optional/format/uri.json30
-rw-r--r--json/tests/draft7/optional/format/relative-json-pointer.json15
-rw-r--r--json/tests/draft7/optional/format/time.json15
-rw-r--r--json/tests/draft7/optional/format/uri.json30
38 files changed, 539 insertions, 160 deletions
diff --git a/json/README.md b/json/README.md
index b3a0939..a0ccf11 100644
--- a/json/README.md
+++ b/json/README.md
@@ -283,8 +283,8 @@ Node-specific support is maintained in a [separate repository](https://github.co
### .NET
+* [JsonSchema.Net](https://github.com/gregsdennis/json-everything)
* [Newtonsoft.Json.Schema](https://github.com/JamesNK/Newtonsoft.Json.Schema)
-* [Manatee.Json](https://github.com/gregsdennis/Manatee.Json)
### Perl
diff --git a/json/remotes/draft-next/locationIndependentIdentifierDraft4.json b/json/remotes/draft-next/locationIndependentIdentifierDraft4.json
deleted file mode 100644
index daf9d41..0000000
--- a/json/remotes/draft-next/locationIndependentIdentifierDraft4.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "$schema": "https://json-schema.org/draft/next/schema",
- "definitions": {
- "refToInteger": {
- "$ref": "#foo"
- },
- "A": {
- "id": "#foo",
- "type": "integer"
- }
- }
-}
diff --git a/json/remotes/draft-next/locationIndependentIdentifierPre2019.json b/json/remotes/draft-next/locationIndependentIdentifierPre2019.json
deleted file mode 100644
index 2a6f4f7..0000000
--- a/json/remotes/draft-next/locationIndependentIdentifierPre2019.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "$schema": "https://json-schema.org/draft/next/schema",
- "definitions": {
- "refToInteger": {
- "$ref": "#foo"
- },
- "A": {
- "$id": "#foo",
- "type": "integer"
- }
- }
-}
diff --git a/json/remotes/draft-next/name.json b/json/remotes/draft-next/name.json
deleted file mode 100644
index 0e4c5e9..0000000
--- a/json/remotes/draft-next/name.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "$schema": "https://json-schema.org/draft/next/schema",
- "definitions": {
- "orNull": {
- "anyOf": [
- {
- "type": "null"
- },
- {
- "$ref": "#"
- }
- ]
- }
- },
- "type": "string"
-}
diff --git a/json/remotes/draft-next/ref-and-definitions.json b/json/remotes/draft-next/ref-and-definitions.json
deleted file mode 100644
index a4573b1..0000000
--- a/json/remotes/draft-next/ref-and-definitions.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "$schema": "https://json-schema.org/draft/next/schema",
- "$id": "http://localhost:1234/draft-next/ref-and-definitions.json",
- "definitions": {
- "inner": {
- "properties": {
- "bar": { "type": "string" }
- }
- }
- },
- "allOf": [ { "$ref": "#/definitions/inner" } ]
-}
diff --git a/json/remotes/draft2019-09/locationIndependentIdentifierDraft4.json b/json/remotes/draft2019-09/locationIndependentIdentifierDraft4.json
deleted file mode 100644
index add7835..0000000
--- a/json/remotes/draft2019-09/locationIndependentIdentifierDraft4.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "$schema": "https://json-schema.org/draft/2019-09/schema",
- "definitions": {
- "refToInteger": {
- "$ref": "#foo"
- },
- "A": {
- "id": "#foo",
- "type": "integer"
- }
- }
-}
diff --git a/json/remotes/draft2019-09/locationIndependentIdentifierPre2019.json b/json/remotes/draft2019-09/locationIndependentIdentifierPre2019.json
deleted file mode 100644
index 5e1eada..0000000
--- a/json/remotes/draft2019-09/locationIndependentIdentifierPre2019.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "$schema": "https://json-schema.org/draft/2019-09/schema",
- "definitions": {
- "refToInteger": {
- "$ref": "#foo"
- },
- "A": {
- "$id": "#foo",
- "type": "integer"
- }
- }
-}
diff --git a/json/remotes/draft2019-09/name.json b/json/remotes/draft2019-09/name.json
deleted file mode 100644
index be27e25..0000000
--- a/json/remotes/draft2019-09/name.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "$schema": "https://json-schema.org/draft/2019-09/schema",
- "definitions": {
- "orNull": {
- "anyOf": [
- {
- "type": "null"
- },
- {
- "$ref": "#"
- }
- ]
- }
- },
- "type": "string"
-}
diff --git a/json/remotes/draft2019-09/ref-and-definitions.json b/json/remotes/draft2019-09/ref-and-definitions.json
deleted file mode 100644
index 2cffd1f..0000000
--- a/json/remotes/draft2019-09/ref-and-definitions.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "$schema": "https://json-schema.org/draft/2019-09/schema",
- "$id": "http://localhost:1234/draft2019-09/ref-and-definitions.json",
- "definitions": {
- "inner": {
- "properties": {
- "bar": { "type": "string" }
- }
- }
- },
- "allOf": [ { "$ref": "#/definitions/inner" } ]
-}
diff --git a/json/remotes/draft2020-12/locationIndependentIdentifierDraft4.json b/json/remotes/draft2020-12/locationIndependentIdentifierDraft4.json
deleted file mode 100644
index 2a03cee..0000000
--- a/json/remotes/draft2020-12/locationIndependentIdentifierDraft4.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "$schema": "https://json-schema.org/draft/2020-12/schema",
- "definitions": {
- "refToInteger": {
- "$ref": "#foo"
- },
- "A": {
- "id": "#foo",
- "type": "integer"
- }
- }
-}
diff --git a/json/remotes/draft2020-12/locationIndependentIdentifierPre2019.json b/json/remotes/draft2020-12/locationIndependentIdentifierPre2019.json
deleted file mode 100644
index 7fd99bd..0000000
--- a/json/remotes/draft2020-12/locationIndependentIdentifierPre2019.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "$schema": "https://json-schema.org/draft/2020-12/schema",
- "definitions": {
- "refToInteger": {
- "$ref": "#foo"
- },
- "A": {
- "$id": "#foo",
- "type": "integer"
- }
- }
-}
diff --git a/json/remotes/draft2020-12/name.json b/json/remotes/draft2020-12/name.json
deleted file mode 100644
index 2ea839d..0000000
--- a/json/remotes/draft2020-12/name.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "$schema": "https://json-schema.org/draft/2020-12/schema",
- "definitions": {
- "orNull": {
- "anyOf": [
- {
- "type": "null"
- },
- {
- "$ref": "#"
- }
- ]
- }
- },
- "type": "string"
-}
diff --git a/json/remotes/draft2020-12/ref-and-definitions.json b/json/remotes/draft2020-12/ref-and-definitions.json
deleted file mode 100644
index 274cba2..0000000
--- a/json/remotes/draft2020-12/ref-and-definitions.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "$schema": "https://json-schema.org/draft/2020-12/schema",
- "$id": "http://localhost:1234/draft2020-12/ref-and-definitions.json",
- "definitions": {
- "inner": {
- "properties": {
- "bar": { "type": "string" }
- }
- }
- },
- "allOf": [ { "$ref": "#/definitions/inner" } ]
-}
diff --git a/json/tests/draft-next/content.json b/json/tests/draft-next/content.json
index 3ddbbf6..37e1f09 100644
--- a/json/tests/draft-next/content.json
+++ b/json/tests/draft-next/content.json
@@ -83,7 +83,7 @@
"$schema": "https://json-schema.org/draft/next/schema",
"contentMediaType": "application/json",
"contentEncoding": "base64",
- "contentSchema": { "required": ["foo"], "properties": { "foo": { "type": "string" } } }
+ "contentSchema": { "type": "object", "required": ["foo"], "properties": { "foo": { "type": "string" } } }
},
"tests": [
{
diff --git a/json/tests/draft-next/dynamicRef.json b/json/tests/draft-next/dynamicRef.json
index 7797dbf..7c360e3 100644
--- a/json/tests/draft-next/dynamicRef.json
+++ b/json/tests/draft-next/dynamicRef.json
@@ -484,5 +484,94 @@
"valid": true
}
]
+ },
+ {
+ "description": "$dynamicAnchor inside propertyDependencies",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "http://localhost:1234/draft2020-12/dynamicanchor-in-propertydependencies.json",
+ "$defs": {
+ "inner": {
+ "$id": "inner",
+ "$dynamicAnchor": "foo",
+ "type": "object",
+ "additionalProperties": {
+ "$dynamicRef": "#foo"
+ }
+ }
+ },
+ "propertyDependencies": {
+ "expectedTypes": {
+ "strings": {
+ "$id": "east",
+ "$ref": "inner",
+ "$defs": {
+ "foo": {
+ "$dynamicAnchor": "foo",
+ "type": "string"
+ }
+ }
+ },
+ "integers": {
+ "$id": "west",
+ "$ref": "inner",
+ "$defs": {
+ "foo": {
+ "$dynamicAnchor": "foo",
+ "type": "integer"
+ }
+ }
+ }
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "expected strings - additional property as string is valid",
+ "data": {
+ "expectedTypes": "strings",
+ "anotherProperty": "also a string"
+ },
+ "valid": true
+ },
+ {
+ "description": "expected strings - additional property as not string is invalid",
+ "data": {
+ "expectedTypes": "strings",
+ "anotherProperty": 42
+ },
+ "valid": false
+ },
+ {
+ "description": "expected integers - additional property as integer is valid",
+ "data": {
+ "expectedTypes": "integers",
+ "anotherProperty": 42
+ },
+ "valid": true
+ },
+ {
+ "description": "expected integers - additional property as not integer is invalid",
+ "data": {
+ "expectedTypes": "integers",
+ "anotherProperty": "a string"
+ },
+ "valid": false
+ },
+ {
+ "description": "expected missing - additional property as an object is valid",
+ "data": {
+ "anotherProperty": {}
+ },
+ "valid": true
+ },
+ {
+ "description": "expected missing - additional property as not object is invalid",
+ "data": {
+ "anotherProperty": 42
+ },
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft-next/optional/format/duration.json b/json/tests/draft-next/optional/format/duration.json
index c890b5d..d5adca2 100644
--- a/json/tests/draft-next/optional/format/duration.json
+++ b/json/tests/draft-next/optional/format/duration.json
@@ -125,6 +125,11 @@
"description": "invalid non-ASCII '২' (a Bengali 2)",
"data": "P২Y",
"valid": false
+ },
+ {
+ "description": "element without unit",
+ "data": "P1",
+ "valid": false
}
]
}
diff --git a/json/tests/draft-next/optional/format/relative-json-pointer.json b/json/tests/draft-next/optional/format/relative-json-pointer.json
index 0eebe03..1e28fc2 100644
--- a/json/tests/draft-next/optional/format/relative-json-pointer.json
+++ b/json/tests/draft-next/optional/format/relative-json-pointer.json
@@ -67,6 +67,11 @@
"valid": false
},
{
+ "description": "explicit positive prefix",
+ "data": "+1/foo/bar",
+ "valid": false
+ },
+ {
"description": "## is not a valid json-pointer",
"data": "0##",
"valid": false
@@ -80,6 +85,16 @@
"description": "zero cannot be followed by other digits, plus octothorpe",
"data": "01#",
"valid": false
+ },
+ {
+ "description": "empty string",
+ "data": "",
+ "valid": false
+ },
+ {
+ "description": "multi-digit integer prefix",
+ "data": "120/foo/bar",
+ "valid": true
}
]
}
diff --git a/json/tests/draft-next/optional/format/time.json b/json/tests/draft-next/optional/format/time.json
index 70dedde..bb58091 100644
--- a/json/tests/draft-next/optional/format/time.json
+++ b/json/tests/draft-next/optional/format/time.json
@@ -192,9 +192,24 @@
"valid": false
},
{
+ "description": "no time offset with second fraction",
+ "data": "12:00:00.52",
+ "valid": false
+ },
+ {
"description": "invalid non-ASCII '২' (a Bengali 2)",
"data": "1২:00:00Z",
"valid": false
+ },
+ {
+ "description": "offset not starting with plus or minus",
+ "data": "08:30:06#00:20",
+ "valid": false
+ },
+ {
+ "description": "contains letters",
+ "data": "ab:cd:ef",
+ "valid": false
}
]
}
diff --git a/json/tests/draft-next/optional/format/uri.json b/json/tests/draft-next/optional/format/uri.json
index 8715918..50908ea 100644
--- a/json/tests/draft-next/optional/format/uri.json
+++ b/json/tests/draft-next/optional/format/uri.json
@@ -7,6 +7,36 @@
},
"tests": [
{
+ "description": "all string formats ignore integers",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore floats",
+ "data": 13.7,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore objects",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore booleans",
+ "data": false,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore nulls",
+ "data": null,
+ "valid": true
+ },
+ {
"description": "a valid URL with anchor tag",
"data": "http://foo.bar/?baz=qux#quux",
"valid": true
diff --git a/json/tests/draft-next/optional/format/uuid.json b/json/tests/draft-next/optional/format/uuid.json
index 62c3c69..6cea9da 100644
--- a/json/tests/draft-next/optional/format/uuid.json
+++ b/json/tests/draft-next/optional/format/uuid.json
@@ -7,6 +7,36 @@
},
"tests": [
{
+ "description": "all string formats ignore integers",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore floats",
+ "data": 13.7,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore objects",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore booleans",
+ "data": false,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore nulls",
+ "data": null,
+ "valid": true
+ },
+ {
"description": "all upper-case",
"data": "2EB8AA08-AA98-11EA-B4AA-73B441D16380",
"valid": true
diff --git a/json/tests/draft-next/unevaluatedProperties.json b/json/tests/draft-next/unevaluatedProperties.json
index cb33fb3..b6df08a 100644
--- a/json/tests/draft-next/unevaluatedProperties.json
+++ b/json/tests/draft-next/unevaluatedProperties.json
@@ -1470,5 +1470,46 @@
"valid": true
}
]
+ },
+ {
+ "description": "unevaluatedProperties can see inside propertyDependencies",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "propertyDependencies": {
+ "foo": {
+ "foo1": {
+ "properties": {
+ "bar": true
+ }
+ }
+ }
+ },
+ "unevaluatedProperties": false
+ },
+ "tests": [
+ {
+ "description": "allows bar if foo = foo1",
+ "data": {
+ "foo": "foo1",
+ "bar": 42
+ },
+ "valid": true
+ },
+ {
+ "description": "disallows bar if foo != foo1",
+ "data": {
+ "foo": "foo2",
+ "bar": 42
+ },
+ "valid": false
+ },
+ {
+ "description": "disallows bar if foo is absent",
+ "data": {
+ "bar": 42
+ },
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft2019-09/content.json b/json/tests/draft2019-09/content.json
index fba6fa3..2a7a5d8 100644
--- a/json/tests/draft2019-09/content.json
+++ b/json/tests/draft2019-09/content.json
@@ -83,7 +83,7 @@
"$schema": "https://json-schema.org/draft/2019-09/schema",
"contentMediaType": "application/json",
"contentEncoding": "base64",
- "contentSchema": { "required": ["foo"], "properties": { "foo": { "type": "string" } } }
+ "contentSchema": { "type": "object", "required": ["foo"], "properties": { "foo": { "type": "string" } } }
},
"tests": [
{
diff --git a/json/tests/draft2019-09/optional/format/duration.json b/json/tests/draft2019-09/optional/format/duration.json
index 0f8acb7..00d5f47 100644
--- a/json/tests/draft2019-09/optional/format/duration.json
+++ b/json/tests/draft2019-09/optional/format/duration.json
@@ -125,6 +125,11 @@
"description": "invalid non-ASCII '২' (a Bengali 2)",
"data": "P২Y",
"valid": false
+ },
+ {
+ "description": "element without unit",
+ "data": "P1",
+ "valid": false
}
]
}
diff --git a/json/tests/draft2019-09/optional/format/relative-json-pointer.json b/json/tests/draft2019-09/optional/format/relative-json-pointer.json
index 9373536..ba97d2a 100644
--- a/json/tests/draft2019-09/optional/format/relative-json-pointer.json
+++ b/json/tests/draft2019-09/optional/format/relative-json-pointer.json
@@ -67,6 +67,11 @@
"valid": false
},
{
+ "description": "explicit positive prefix",
+ "data": "+1/foo/bar",
+ "valid": false
+ },
+ {
"description": "## is not a valid json-pointer",
"data": "0##",
"valid": false
@@ -80,6 +85,16 @@
"description": "zero cannot be followed by other digits, plus octothorpe",
"data": "01#",
"valid": false
+ },
+ {
+ "description": "empty string",
+ "data": "",
+ "valid": false
+ },
+ {
+ "description": "multi-digit integer prefix",
+ "data": "120/foo/bar",
+ "valid": true
}
]
}
diff --git a/json/tests/draft2019-09/optional/format/time.json b/json/tests/draft2019-09/optional/format/time.json
index 51ba31f..3056376 100644
--- a/json/tests/draft2019-09/optional/format/time.json
+++ b/json/tests/draft2019-09/optional/format/time.json
@@ -192,9 +192,24 @@
"valid": false
},
{
+ "description": "no time offset with second fraction",
+ "data": "12:00:00.52",
+ "valid": false
+ },
+ {
"description": "invalid non-ASCII '২' (a Bengali 2)",
"data": "1২:00:00Z",
"valid": false
+ },
+ {
+ "description": "offset not starting with plus or minus",
+ "data": "08:30:06#00:20",
+ "valid": false
+ },
+ {
+ "description": "contains letters",
+ "data": "ab:cd:ef",
+ "valid": false
}
]
}
diff --git a/json/tests/draft2019-09/optional/format/uri.json b/json/tests/draft2019-09/optional/format/uri.json
index 149af98..ad67840 100644
--- a/json/tests/draft2019-09/optional/format/uri.json
+++ b/json/tests/draft2019-09/optional/format/uri.json
@@ -7,6 +7,36 @@
},
"tests": [
{
+ "description": "all string formats ignore integers",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore floats",
+ "data": 13.7,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore objects",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore booleans",
+ "data": false,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore nulls",
+ "data": null,
+ "valid": true
+ },
+ {
"description": "a valid URL with anchor tag",
"data": "http://foo.bar/?baz=qux#quux",
"valid": true
diff --git a/json/tests/draft2019-09/optional/format/uuid.json b/json/tests/draft2019-09/optional/format/uuid.json
index 6c6e4e9..dc6fb7e 100644
--- a/json/tests/draft2019-09/optional/format/uuid.json
+++ b/json/tests/draft2019-09/optional/format/uuid.json
@@ -7,6 +7,36 @@
},
"tests": [
{
+ "description": "all string formats ignore integers",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore floats",
+ "data": 13.7,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore objects",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore booleans",
+ "data": false,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore nulls",
+ "data": null,
+ "valid": true
+ },
+ {
"description": "all upper-case",
"data": "2EB8AA08-AA98-11EA-B4AA-73B441D16380",
"valid": true
diff --git a/json/tests/draft2020-12/content.json b/json/tests/draft2020-12/content.json
index 33814d7..698f780 100644
--- a/json/tests/draft2020-12/content.json
+++ b/json/tests/draft2020-12/content.json
@@ -83,7 +83,7 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contentMediaType": "application/json",
"contentEncoding": "base64",
- "contentSchema": { "required": ["foo"], "properties": { "foo": { "type": "string" } } }
+ "contentSchema": { "type": "object", "required": ["foo"], "properties": { "foo": { "type": "string" } } }
},
"tests": [
{
diff --git a/json/tests/draft2020-12/optional/format/duration.json b/json/tests/draft2020-12/optional/format/duration.json
index 18fccd3..a3af56e 100644
--- a/json/tests/draft2020-12/optional/format/duration.json
+++ b/json/tests/draft2020-12/optional/format/duration.json
@@ -125,6 +125,11 @@
"description": "invalid non-ASCII '২' (a Bengali 2)",
"data": "P২Y",
"valid": false
+ },
+ {
+ "description": "element without unit",
+ "data": "P1",
+ "valid": false
}
]
}
diff --git a/json/tests/draft2020-12/optional/format/relative-json-pointer.json b/json/tests/draft2020-12/optional/format/relative-json-pointer.json
index 3454b63..3eaf9ce 100644
--- a/json/tests/draft2020-12/optional/format/relative-json-pointer.json
+++ b/json/tests/draft2020-12/optional/format/relative-json-pointer.json
@@ -67,6 +67,11 @@
"valid": false
},
{
+ "description": "explicit positive prefix",
+ "data": "+1/foo/bar",
+ "valid": false
+ },
+ {
"description": "## is not a valid json-pointer",
"data": "0##",
"valid": false
@@ -80,6 +85,16 @@
"description": "zero cannot be followed by other digits, plus octothorpe",
"data": "01#",
"valid": false
+ },
+ {
+ "description": "empty string",
+ "data": "",
+ "valid": false
+ },
+ {
+ "description": "multi-digit integer prefix",
+ "data": "120/foo/bar",
+ "valid": true
}
]
}
diff --git a/json/tests/draft2020-12/optional/format/time.json b/json/tests/draft2020-12/optional/format/time.json
index e5d1ddd..ae31d2c 100644
--- a/json/tests/draft2020-12/optional/format/time.json
+++ b/json/tests/draft2020-12/optional/format/time.json
@@ -192,9 +192,24 @@
"valid": false
},
{
+ "description": "no time offset with second fraction",
+ "data": "12:00:00.52",
+ "valid": false
+ },
+ {
"description": "invalid non-ASCII '২' (a Bengali 2)",
"data": "1২:00:00Z",
"valid": false
+ },
+ {
+ "description": "offset not starting with plus or minus",
+ "data": "08:30:06#00:20",
+ "valid": false
+ },
+ {
+ "description": "contains letters",
+ "data": "ab:cd:ef",
+ "valid": false
}
]
}
diff --git a/json/tests/draft2020-12/optional/format/uri.json b/json/tests/draft2020-12/optional/format/uri.json
index dab566e..84b5f15 100644
--- a/json/tests/draft2020-12/optional/format/uri.json
+++ b/json/tests/draft2020-12/optional/format/uri.json
@@ -7,6 +7,36 @@
},
"tests": [
{
+ "description": "all string formats ignore integers",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore floats",
+ "data": 13.7,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore objects",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore booleans",
+ "data": false,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore nulls",
+ "data": null,
+ "valid": true
+ },
+ {
"description": "a valid URL with anchor tag",
"data": "http://foo.bar/?baz=qux#quux",
"valid": true
diff --git a/json/tests/draft2020-12/optional/format/uuid.json b/json/tests/draft2020-12/optional/format/uuid.json
index 95f1488..d152643 100644
--- a/json/tests/draft2020-12/optional/format/uuid.json
+++ b/json/tests/draft2020-12/optional/format/uuid.json
@@ -7,6 +7,36 @@
},
"tests": [
{
+ "description": "all string formats ignore integers",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore floats",
+ "data": 13.7,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore objects",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore booleans",
+ "data": false,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore nulls",
+ "data": null,
+ "valid": true
+ },
+ {
"description": "all upper-case",
"data": "2EB8AA08-AA98-11EA-B4AA-73B441D16380",
"valid": true
diff --git a/json/tests/draft4/optional/format/uri.json b/json/tests/draft4/optional/format/uri.json
index 792d71a..4b48d40 100644
--- a/json/tests/draft4/optional/format/uri.json
+++ b/json/tests/draft4/optional/format/uri.json
@@ -4,6 +4,36 @@
"schema": { "format": "uri" },
"tests": [
{
+ "description": "all string formats ignore integers",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore floats",
+ "data": 13.7,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore objects",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore booleans",
+ "data": false,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore nulls",
+ "data": null,
+ "valid": true
+ },
+ {
"description": "a valid URL with anchor tag",
"data": "http://foo.bar/?baz=qux#quux",
"valid": true
diff --git a/json/tests/draft6/optional/format/uri.json b/json/tests/draft6/optional/format/uri.json
index 792d71a..4b48d40 100644
--- a/json/tests/draft6/optional/format/uri.json
+++ b/json/tests/draft6/optional/format/uri.json
@@ -4,6 +4,36 @@
"schema": { "format": "uri" },
"tests": [
{
+ "description": "all string formats ignore integers",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore floats",
+ "data": 13.7,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore objects",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore booleans",
+ "data": false,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore nulls",
+ "data": null,
+ "valid": true
+ },
+ {
"description": "a valid URL with anchor tag",
"data": "http://foo.bar/?baz=qux#quux",
"valid": true
diff --git a/json/tests/draft7/optional/format/relative-json-pointer.json b/json/tests/draft7/optional/format/relative-json-pointer.json
index 9309986..e50e505 100644
--- a/json/tests/draft7/optional/format/relative-json-pointer.json
+++ b/json/tests/draft7/optional/format/relative-json-pointer.json
@@ -64,6 +64,11 @@
"valid": false
},
{
+ "description": "explicit positive prefix",
+ "data": "+1/foo/bar",
+ "valid": false
+ },
+ {
"description": "## is not a valid json-pointer",
"data": "0##",
"valid": false
@@ -77,6 +82,16 @@
"description": "zero cannot be followed by other digits, plus octothorpe",
"data": "01#",
"valid": false
+ },
+ {
+ "description": "empty string",
+ "data": "",
+ "valid": false
+ },
+ {
+ "description": "multi-digit integer prefix",
+ "data": "120/foo/bar",
+ "valid": true
}
]
}
diff --git a/json/tests/draft7/optional/format/time.json b/json/tests/draft7/optional/format/time.json
index 3142587..920db61 100644
--- a/json/tests/draft7/optional/format/time.json
+++ b/json/tests/draft7/optional/format/time.json
@@ -189,9 +189,24 @@
"valid": false
},
{
+ "description": "no time offset with second fraction",
+ "data": "12:00:00.52",
+ "valid": false
+ },
+ {
"description": "invalid non-ASCII '২' (a Bengali 2)",
"data": "1২:00:00Z",
"valid": false
+ },
+ {
+ "description": "offset not starting with plus or minus",
+ "data": "08:30:06#00:20",
+ "valid": false
+ },
+ {
+ "description": "contains letters",
+ "data": "ab:cd:ef",
+ "valid": false
}
]
}
diff --git a/json/tests/draft7/optional/format/uri.json b/json/tests/draft7/optional/format/uri.json
index 792d71a..4b48d40 100644
--- a/json/tests/draft7/optional/format/uri.json
+++ b/json/tests/draft7/optional/format/uri.json
@@ -4,6 +4,36 @@
"schema": { "format": "uri" },
"tests": [
{
+ "description": "all string formats ignore integers",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore floats",
+ "data": 13.7,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore objects",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore booleans",
+ "data": false,
+ "valid": true
+ },
+ {
+ "description": "all string formats ignore nulls",
+ "data": null,
+ "valid": true
+ },
+ {
"description": "a valid URL with anchor tag",
"data": "http://foo.bar/?baz=qux#quux",
"valid": true