diff --git a/README.md b/README.md index b79b89a59..63053d672 100644 --- a/README.md +++ b/README.md @@ -61,8 +61,8 @@ directory. This is: ## Coverage Drafts 07, 06, 04, and 03 should have full coverage, with tests for drafts 06, -07, and 2019-09 being considered current and actively supported. Draft 2019-09 -is almost fully covered. +07, 2019-09 and 2020-12 being considered current and actively supported. +Drafts 2019-09 and 2020-12 are almost fully covered. Contributions are very welcome, especially from implementers as they add support to their own implementations. @@ -95,11 +95,11 @@ This suite is being used by: ### Dart -* [json_schema](https://github.com/patefacio/json_schema) +* [json\_schema](https://github.com/patefacio/json_schema) ### Elixir -* [ex_json_schema](https://github.com/jonasschmidt/ex_json_schema) +* [ex\_json\_schema](https://github.com/jonasschmidt/ex_json_schema) ### Erlang @@ -159,17 +159,19 @@ which also welcomes your contributions! ### Perl * [JSON::Schema::Draft201909](https://github.com/karenetheridge/JSON-Schema-Draft201909) +* [JSON::Schema::Tiny](https://github.com/karenetheridge/JSON-Schema-Tiny) * [Test::JSON::Schema::Acceptance](https://github.com/karenetheridge/Test-JSON-Schema-Acceptance) ### PHP +* [opis/json-schema](https://github.com/opis/json-schema) * [json-schema](https://github.com/justinrainbow/json-schema) * [json-guard](https://github.com/thephpleague/json-guard) ### PostgreSQL * [postgres-json-schema](https://github.com/gavinwahl/postgres-json-schema) -* [is_jsonb_valid](https://github.com/furstenheim/is_jsonb_valid) +* [is\_jsonb\_valid](https://github.com/furstenheim/is_jsonb_valid) ### Python @@ -181,7 +183,7 @@ which also welcomes your contributions! ### Ruby * [json-schema](https://github.com/hoxworth/json-schema) -* [json_schemer](https://github.com/davishmcclurg/json_schemer) +* [json\_schemer](https://github.com/davishmcclurg/json_schemer) ### Rust diff --git a/tests/draft2019-09/additionalItems.json b/tests/draft2019-09/additionalItems.json index ee46b61a1..784bc8461 100644 --- a/tests/draft2019-09/additionalItems.json +++ b/tests/draft2019-09/additionalItems.json @@ -19,7 +19,7 @@ ] }, { - "description": "items is schema, no additionalItems", + "description": "when items is schema, additionalItems does nothing", "schema": { "items": {}, "additionalItems": false @@ -33,7 +33,7 @@ ] }, { - "description": "array of items with no additionalItems", + "description": "array of items with no additionalItems permitted", "schema": { "items": [{}, {}, {}], "additionalItems": false @@ -126,5 +126,24 @@ "valid": false } ] + }, + { + "description": "items validation adjusts the starting index for additionalItems", + "schema": { + "items": [ { "type": "string" } ], + "additionalItems": { "type": "integer" } + }, + "tests": [ + { + "description": "valid items", + "data": [ "x", 2, 3 ], + "valid": true + }, + { + "description": "wrong type of second item", + "data": [ "x", "y" ], + "valid": false + } + ] } ] diff --git a/tests/draft2019-09/default.json b/tests/draft2019-09/default.json index 17629779f..289a9b66c 100644 --- a/tests/draft2019-09/default.json +++ b/tests/draft2019-09/default.json @@ -45,5 +45,35 @@ "valid": true } ] + }, + { + "description": "the default keyword does not do anything if the property is missing", + "schema": { + "type": "object", + "properties": { + "alpha": { + "type": "number", + "maximum": 3, + "default": 5 + } + } + }, + "tests": [ + { + "description": "an explicit property value is checked against maximum (passing)", + "data": { "alpha": 1 }, + "valid": true + }, + { + "description": "an explicit property value is checked against maximum (failing)", + "data": { "alpha": 5 }, + "valid": false + }, + { + "description": "missing properties are not filled in with the default", + "data": {}, + "valid": true + } + ] } ] diff --git a/tests/draft2019-09/optional/format/time.json b/tests/draft2019-09/optional/format/time.json index 4ec8a01a3..74e8bf9e0 100644 --- a/tests/draft2019-09/optional/format/time.json +++ b/tests/draft2019-09/optional/format/time.json @@ -5,9 +5,84 @@ "tests": [ { "description": "a valid time string", + "data": "08:30:06Z", + "valid": true + }, + { + "description": "a valid time string with leap second", + "data": "23:59:60Z", + "valid": true + }, + { + "description": "a valid time string with leap second with offset", + "data": "15:59:60-08:00", + "valid": true + }, + { + "description": "a valid time string with second fraction", + "data": "23:20:50.52Z", + "valid": true + }, + { + "description": "a valid time string with precise second fraction", "data": "08:30:06.283185Z", "valid": true }, + { + "description": "a valid time string with plus offset", + "data": "08:30:06+00:20", + "valid": true + }, + { + "description": "a valid time string with minus offset", + "data": "08:30:06-08:00", + "valid": true + }, + { + "description": "a valid time string with case-insensitive Z", + "data": "08:30:06z", + "valid": true + }, + { + "description": "an invalid time string with invalid hour", + "data": "24:00:00Z", + "valid": false + }, + { + "description": "an invalid time string with invalid minute", + "data": "00:60:00Z", + "valid": false + }, + { + "description": "an invalid time string with invalid second", + "data": "00:00:61Z", + "valid": false + }, + { + "description": "an invalid time string with invalid leap second (wrong hour)", + "data": "22:59:60Z", + "valid": false + }, + { + "description": "an invalid time string with invalid leap second (wrong minute)", + "data": "23:58:60Z", + "valid": false + }, + { + "description": "an invalid time string with invalid time numoffset hour", + "data": "01:02:03+24:00", + "valid": false + }, + { + "description": "an invalid time string with invalid time numoffset minute", + "data": "01:02:03+00:60", + "valid": false + }, + { + "description": "an invalid time string with invalid time with both Z and numoffset", + "data": "01:02:03Z+00:30", + "valid": false + }, { "description": "an invalid time string", "data": "08:30:06 PST", diff --git a/tests/draft2019-09/ref.json b/tests/draft2019-09/ref.json index 2da81e35f..71cf509f7 100644 --- a/tests/draft2019-09/ref.json +++ b/tests/draft2019-09/ref.json @@ -420,10 +420,15 @@ }, "tests": [ { - "description": "do not evaluate the $ref inside the enum", + "description": "do not evaluate the $ref inside the enum, matching any string", "data": "this is a string", "valid": false }, + { + "description": "do not evaluate the $ref inside the enum, definition exact match", + "data": { "type": "string" }, + "valid": false + }, { "description": "match the enum exactly", "data": { "$ref": "#/$defs/a_string" }, diff --git a/tests/draft2020-12/default.json b/tests/draft2020-12/default.json index 17629779f..289a9b66c 100644 --- a/tests/draft2020-12/default.json +++ b/tests/draft2020-12/default.json @@ -45,5 +45,35 @@ "valid": true } ] + }, + { + "description": "the default keyword does not do anything if the property is missing", + "schema": { + "type": "object", + "properties": { + "alpha": { + "type": "number", + "maximum": 3, + "default": 5 + } + } + }, + "tests": [ + { + "description": "an explicit property value is checked against maximum (passing)", + "data": { "alpha": 1 }, + "valid": true + }, + { + "description": "an explicit property value is checked against maximum (failing)", + "data": { "alpha": 5 }, + "valid": false + }, + { + "description": "missing properties are not filled in with the default", + "data": {}, + "valid": true + } + ] } ] diff --git a/tests/draft2020-12/items.json b/tests/draft2020-12/items.json index 08a49ee95..b91819452 100644 --- a/tests/draft2020-12/items.json +++ b/tests/draft2020-12/items.json @@ -233,5 +233,24 @@ "valid": true } ] + }, + { + "description": "prefixItems validation adjusts the starting index for items", + "schema": { + "prefixItems": [ { "type": "string" } ], + "items": { "type": "integer" } + }, + "tests": [ + { + "description": "valid items", + "data": [ "x", 2, 3 ], + "valid": true + }, + { + "description": "wrong type of second item", + "data": [ "x", "y" ], + "valid": false + } + ] } ] diff --git a/tests/draft2020-12/optional/format/time.json b/tests/draft2020-12/optional/format/time.json index 4ec8a01a3..74e8bf9e0 100644 --- a/tests/draft2020-12/optional/format/time.json +++ b/tests/draft2020-12/optional/format/time.json @@ -5,9 +5,84 @@ "tests": [ { "description": "a valid time string", + "data": "08:30:06Z", + "valid": true + }, + { + "description": "a valid time string with leap second", + "data": "23:59:60Z", + "valid": true + }, + { + "description": "a valid time string with leap second with offset", + "data": "15:59:60-08:00", + "valid": true + }, + { + "description": "a valid time string with second fraction", + "data": "23:20:50.52Z", + "valid": true + }, + { + "description": "a valid time string with precise second fraction", "data": "08:30:06.283185Z", "valid": true }, + { + "description": "a valid time string with plus offset", + "data": "08:30:06+00:20", + "valid": true + }, + { + "description": "a valid time string with minus offset", + "data": "08:30:06-08:00", + "valid": true + }, + { + "description": "a valid time string with case-insensitive Z", + "data": "08:30:06z", + "valid": true + }, + { + "description": "an invalid time string with invalid hour", + "data": "24:00:00Z", + "valid": false + }, + { + "description": "an invalid time string with invalid minute", + "data": "00:60:00Z", + "valid": false + }, + { + "description": "an invalid time string with invalid second", + "data": "00:00:61Z", + "valid": false + }, + { + "description": "an invalid time string with invalid leap second (wrong hour)", + "data": "22:59:60Z", + "valid": false + }, + { + "description": "an invalid time string with invalid leap second (wrong minute)", + "data": "23:58:60Z", + "valid": false + }, + { + "description": "an invalid time string with invalid time numoffset hour", + "data": "01:02:03+24:00", + "valid": false + }, + { + "description": "an invalid time string with invalid time numoffset minute", + "data": "01:02:03+00:60", + "valid": false + }, + { + "description": "an invalid time string with invalid time with both Z and numoffset", + "data": "01:02:03Z+00:30", + "valid": false + }, { "description": "an invalid time string", "data": "08:30:06 PST", diff --git a/tests/draft2020-12/ref.json b/tests/draft2020-12/ref.json index d74e4a31c..cd002a05c 100644 --- a/tests/draft2020-12/ref.json +++ b/tests/draft2020-12/ref.json @@ -422,10 +422,15 @@ }, "tests": [ { - "description": "do not evaluate the $ref inside the enum", + "description": "do not evaluate the $ref inside the enum, matching any string", "data": "this is a string", "valid": false }, + { + "description": "do not evaluate the $ref inside the enum, definition exact match", + "data": { "type": "string" }, + "valid": false + }, { "description": "match the enum exactly", "data": { "$ref": "#/$defs/a_string" }, diff --git a/tests/draft2020-12/unevaluatedItems.json b/tests/draft2020-12/unevaluatedItems.json index 13c80a2a2..00617695b 100644 --- a/tests/draft2020-12/unevaluatedItems.json +++ b/tests/draft2020-12/unevaluatedItems.json @@ -485,5 +485,113 @@ "valid": false } ] + }, + { + "description": "unevaluatedItems depends on adjacent contains", + "schema": { + "prefixItems": [true], + "contains": {"type": "string"}, + "unevaluatedItems": false + }, + "tests": [ + { + "description": "second item is evaluated by contains", + "data": [ 1, "foo" ], + "valid": true + }, + { + "description": "contains fails, second item is not evaluated", + "data": [ 1, 2 ], + "valid": false + }, + { + "description": "contains passes, second item is not evaluated", + "data": [ 1, 2, "foo" ], + "valid": false + } + ] + }, + { + "description": "unevaluatedItems depends on multiple nested contains", + "schema": { + "allOf": [ + { "contains": { "multipleOf": 2 } }, + { "contains": { "multipleOf": 3 } } + ], + "unevaluatedItems": { "multipleOf": 5 } + }, + "tests": [ + { + "description": "5 not evaluated, passes unevaluatedItems", + "data": [ 2, 3, 4, 5, 6 ], + "valid": true + }, + { + "description": "7 not evaluated, fails unevaluatedItems", + "data": [ 2, 3, 4, 7, 8 ], + "valid": false + } + ] + }, + { + "description": "unevaluatedItems and contains interact to control item dependency relationship", + "schema": { + "if": { + "contains": {"const": "a"} + }, + "then": { + "if": { + "contains": {"const": "b"} + }, + "then": { + "if": { + "contains": {"const": "c"} + } + } + }, + "unevaluatedItems": false + }, + "tests": [ + { + "description": "empty array is valid", + "data": [], + "valid": true + }, + { + "description": "only a's are valid", + "data": [ "a", "a" ], + "valid": true + }, + { + "description": "a's and b's are valid", + "data": [ "a", "b", "a", "b", "a" ], + "valid": true + }, + { + "description": "a's, b's and c's are valid", + "data": [ "c", "a", "c", "c", "b", "a" ], + "valid": true + }, + { + "description": "only b's are invalid", + "data": [ "b", "b" ], + "valid": false + }, + { + "description": "only c's are invalid", + "data": [ "c", "c" ], + "valid": false + }, + { + "description": "only b's and c's are invalid", + "data": [ "c", "b", "c", "b", "c" ], + "valid": false + }, + { + "description": "only a's and c's are invalid", + "data": [ "c", "a", "c", "a", "c" ], + "valid": false + } + ] } ] diff --git a/tests/draft3/additionalItems.json b/tests/draft3/additionalItems.json index 1e8ebdcc6..910f1d66d 100644 --- a/tests/draft3/additionalItems.json +++ b/tests/draft3/additionalItems.json @@ -19,7 +19,7 @@ ] }, { - "description": "items is schema, no additionalItems", + "description": "when items is schema, additionalItems does nothing", "schema": { "items": {}, "additionalItems": false @@ -33,7 +33,7 @@ ] }, { - "description": "array of items with no additionalItems", + "description": "array of items with no additionalItems permitted", "schema": { "items": [{}, {}, {}], "additionalItems": false diff --git a/tests/draft3/default.json b/tests/draft3/default.json index 17629779f..289a9b66c 100644 --- a/tests/draft3/default.json +++ b/tests/draft3/default.json @@ -45,5 +45,35 @@ "valid": true } ] + }, + { + "description": "the default keyword does not do anything if the property is missing", + "schema": { + "type": "object", + "properties": { + "alpha": { + "type": "number", + "maximum": 3, + "default": 5 + } + } + }, + "tests": [ + { + "description": "an explicit property value is checked against maximum (passing)", + "data": { "alpha": 1 }, + "valid": true + }, + { + "description": "an explicit property value is checked against maximum (failing)", + "data": { "alpha": 5 }, + "valid": false + }, + { + "description": "missing properties are not filled in with the default", + "data": {}, + "valid": true + } + ] } ] diff --git a/tests/draft3/ref.json b/tests/draft3/ref.json index ebdb236b7..26dcb52d0 100644 --- a/tests/draft3/ref.json +++ b/tests/draft3/ref.json @@ -228,7 +228,7 @@ }, "tests": [ { - "description": "do not evaluate the $ref inside the enum", + "description": "do not evaluate the $ref inside the enum, matching any string", "data": "this is a string", "valid": false }, diff --git a/tests/draft4/additionalItems.json b/tests/draft4/additionalItems.json index ee46b61a1..784bc8461 100644 --- a/tests/draft4/additionalItems.json +++ b/tests/draft4/additionalItems.json @@ -19,7 +19,7 @@ ] }, { - "description": "items is schema, no additionalItems", + "description": "when items is schema, additionalItems does nothing", "schema": { "items": {}, "additionalItems": false @@ -33,7 +33,7 @@ ] }, { - "description": "array of items with no additionalItems", + "description": "array of items with no additionalItems permitted", "schema": { "items": [{}, {}, {}], "additionalItems": false @@ -126,5 +126,24 @@ "valid": false } ] + }, + { + "description": "items validation adjusts the starting index for additionalItems", + "schema": { + "items": [ { "type": "string" } ], + "additionalItems": { "type": "integer" } + }, + "tests": [ + { + "description": "valid items", + "data": [ "x", 2, 3 ], + "valid": true + }, + { + "description": "wrong type of second item", + "data": [ "x", "y" ], + "valid": false + } + ] } ] diff --git a/tests/draft4/default.json b/tests/draft4/default.json index 17629779f..289a9b66c 100644 --- a/tests/draft4/default.json +++ b/tests/draft4/default.json @@ -45,5 +45,35 @@ "valid": true } ] + }, + { + "description": "the default keyword does not do anything if the property is missing", + "schema": { + "type": "object", + "properties": { + "alpha": { + "type": "number", + "maximum": 3, + "default": 5 + } + } + }, + "tests": [ + { + "description": "an explicit property value is checked against maximum (passing)", + "data": { "alpha": 1 }, + "valid": true + }, + { + "description": "an explicit property value is checked against maximum (failing)", + "data": { "alpha": 5 }, + "valid": false + }, + { + "description": "missing properties are not filled in with the default", + "data": {}, + "valid": true + } + ] } ] diff --git a/tests/draft4/ref.json b/tests/draft4/ref.json index 33f744145..48544ba52 100644 --- a/tests/draft4/ref.json +++ b/tests/draft4/ref.json @@ -447,7 +447,7 @@ }, "tests": [ { - "description": "do not evaluate the $ref inside the enum", + "description": "do not evaluate the $ref inside the enum, matching any string", "data": "this is a string", "valid": false }, diff --git a/tests/draft6/additionalItems.json b/tests/draft6/additionalItems.json index ee46b61a1..784bc8461 100644 --- a/tests/draft6/additionalItems.json +++ b/tests/draft6/additionalItems.json @@ -19,7 +19,7 @@ ] }, { - "description": "items is schema, no additionalItems", + "description": "when items is schema, additionalItems does nothing", "schema": { "items": {}, "additionalItems": false @@ -33,7 +33,7 @@ ] }, { - "description": "array of items with no additionalItems", + "description": "array of items with no additionalItems permitted", "schema": { "items": [{}, {}, {}], "additionalItems": false @@ -126,5 +126,24 @@ "valid": false } ] + }, + { + "description": "items validation adjusts the starting index for additionalItems", + "schema": { + "items": [ { "type": "string" } ], + "additionalItems": { "type": "integer" } + }, + "tests": [ + { + "description": "valid items", + "data": [ "x", 2, 3 ], + "valid": true + }, + { + "description": "wrong type of second item", + "data": [ "x", "y" ], + "valid": false + } + ] } ] diff --git a/tests/draft6/default.json b/tests/draft6/default.json index 17629779f..289a9b66c 100644 --- a/tests/draft6/default.json +++ b/tests/draft6/default.json @@ -45,5 +45,35 @@ "valid": true } ] + }, + { + "description": "the default keyword does not do anything if the property is missing", + "schema": { + "type": "object", + "properties": { + "alpha": { + "type": "number", + "maximum": 3, + "default": 5 + } + } + }, + "tests": [ + { + "description": "an explicit property value is checked against maximum (passing)", + "data": { "alpha": 1 }, + "valid": true + }, + { + "description": "an explicit property value is checked against maximum (failing)", + "data": { "alpha": 5 }, + "valid": false + }, + { + "description": "missing properties are not filled in with the default", + "data": {}, + "valid": true + } + ] } ] diff --git a/tests/draft6/id.json b/tests/draft6/id.json index 1c91d33ee..d276001c2 100644 --- a/tests/draft6/id.json +++ b/tests/draft6/id.json @@ -7,18 +7,18 @@ "id_in_enum": { "enum": [ { - "id": "https://localhost:1234/my_identifier.json", + "$id": "https://localhost:1234/my_identifier.json", "type": "null" } ] }, "real_id_in_schema": { - "id": "https://localhost:1234/my_identifier.json", + "$id": "https://localhost:1234/my_identifier.json", "type": "string" }, "zzz_id_in_const": { "const": { - "id": "https://localhost:1234/my_identifier.json", + "$id": "https://localhost:1234/my_identifier.json", "type": "null" } } @@ -32,7 +32,7 @@ { "description": "exact match to enum, and type matches", "data": { - "id": "https://localhost:1234/my_identifier.json", + "$id": "https://localhost:1234/my_identifier.json", "type": "null" }, "valid": true diff --git a/tests/draft6/ref.json b/tests/draft6/ref.json index 676d6a06d..0357f3e3b 100644 --- a/tests/draft6/ref.json +++ b/tests/draft6/ref.json @@ -479,10 +479,15 @@ }, "tests": [ { - "description": "do not evaluate the $ref inside the enum", + "description": "do not evaluate the $ref inside the enum, matching any string", "data": "this is a string", "valid": false }, + { + "description": "do not evaluate the $ref inside the enum, definition exact match", + "data": { "type": "string" }, + "valid": false + }, { "description": "match the enum exactly", "data": { "$ref": "#/definitions/a_string" }, diff --git a/tests/draft7/additionalItems.json b/tests/draft7/additionalItems.json index ee46b61a1..784bc8461 100644 --- a/tests/draft7/additionalItems.json +++ b/tests/draft7/additionalItems.json @@ -19,7 +19,7 @@ ] }, { - "description": "items is schema, no additionalItems", + "description": "when items is schema, additionalItems does nothing", "schema": { "items": {}, "additionalItems": false @@ -33,7 +33,7 @@ ] }, { - "description": "array of items with no additionalItems", + "description": "array of items with no additionalItems permitted", "schema": { "items": [{}, {}, {}], "additionalItems": false @@ -126,5 +126,24 @@ "valid": false } ] + }, + { + "description": "items validation adjusts the starting index for additionalItems", + "schema": { + "items": [ { "type": "string" } ], + "additionalItems": { "type": "integer" } + }, + "tests": [ + { + "description": "valid items", + "data": [ "x", 2, 3 ], + "valid": true + }, + { + "description": "wrong type of second item", + "data": [ "x", "y" ], + "valid": false + } + ] } ] diff --git a/tests/draft7/default.json b/tests/draft7/default.json index 17629779f..289a9b66c 100644 --- a/tests/draft7/default.json +++ b/tests/draft7/default.json @@ -45,5 +45,35 @@ "valid": true } ] + }, + { + "description": "the default keyword does not do anything if the property is missing", + "schema": { + "type": "object", + "properties": { + "alpha": { + "type": "number", + "maximum": 3, + "default": 5 + } + } + }, + "tests": [ + { + "description": "an explicit property value is checked against maximum (passing)", + "data": { "alpha": 1 }, + "valid": true + }, + { + "description": "an explicit property value is checked against maximum (failing)", + "data": { "alpha": 5 }, + "valid": false + }, + { + "description": "missing properties are not filled in with the default", + "data": {}, + "valid": true + } + ] } ] diff --git a/tests/draft7/id.json b/tests/draft7/id.json index 1c91d33ee..d276001c2 100644 --- a/tests/draft7/id.json +++ b/tests/draft7/id.json @@ -7,18 +7,18 @@ "id_in_enum": { "enum": [ { - "id": "https://localhost:1234/my_identifier.json", + "$id": "https://localhost:1234/my_identifier.json", "type": "null" } ] }, "real_id_in_schema": { - "id": "https://localhost:1234/my_identifier.json", + "$id": "https://localhost:1234/my_identifier.json", "type": "string" }, "zzz_id_in_const": { "const": { - "id": "https://localhost:1234/my_identifier.json", + "$id": "https://localhost:1234/my_identifier.json", "type": "null" } } @@ -32,7 +32,7 @@ { "description": "exact match to enum, and type matches", "data": { - "id": "https://localhost:1234/my_identifier.json", + "$id": "https://localhost:1234/my_identifier.json", "type": "null" }, "valid": true diff --git a/tests/draft7/optional/format/time.json b/tests/draft7/optional/format/time.json index 4ec8a01a3..74e8bf9e0 100644 --- a/tests/draft7/optional/format/time.json +++ b/tests/draft7/optional/format/time.json @@ -5,9 +5,84 @@ "tests": [ { "description": "a valid time string", + "data": "08:30:06Z", + "valid": true + }, + { + "description": "a valid time string with leap second", + "data": "23:59:60Z", + "valid": true + }, + { + "description": "a valid time string with leap second with offset", + "data": "15:59:60-08:00", + "valid": true + }, + { + "description": "a valid time string with second fraction", + "data": "23:20:50.52Z", + "valid": true + }, + { + "description": "a valid time string with precise second fraction", "data": "08:30:06.283185Z", "valid": true }, + { + "description": "a valid time string with plus offset", + "data": "08:30:06+00:20", + "valid": true + }, + { + "description": "a valid time string with minus offset", + "data": "08:30:06-08:00", + "valid": true + }, + { + "description": "a valid time string with case-insensitive Z", + "data": "08:30:06z", + "valid": true + }, + { + "description": "an invalid time string with invalid hour", + "data": "24:00:00Z", + "valid": false + }, + { + "description": "an invalid time string with invalid minute", + "data": "00:60:00Z", + "valid": false + }, + { + "description": "an invalid time string with invalid second", + "data": "00:00:61Z", + "valid": false + }, + { + "description": "an invalid time string with invalid leap second (wrong hour)", + "data": "22:59:60Z", + "valid": false + }, + { + "description": "an invalid time string with invalid leap second (wrong minute)", + "data": "23:58:60Z", + "valid": false + }, + { + "description": "an invalid time string with invalid time numoffset hour", + "data": "01:02:03+24:00", + "valid": false + }, + { + "description": "an invalid time string with invalid time numoffset minute", + "data": "01:02:03+00:60", + "valid": false + }, + { + "description": "an invalid time string with invalid time with both Z and numoffset", + "data": "01:02:03Z+00:30", + "valid": false + }, { "description": "an invalid time string", "data": "08:30:06 PST", diff --git a/tests/draft7/ref.json b/tests/draft7/ref.json index 80a4d1d0f..2ad01935c 100644 --- a/tests/draft7/ref.json +++ b/tests/draft7/ref.json @@ -479,10 +479,15 @@ }, "tests": [ { - "description": "do not evaluate the $ref inside the enum", + "description": "do not evaluate the $ref inside the enum, matching any string", "data": "this is a string", "valid": false }, + { + "description": "do not evaluate the $ref inside the enum, definition exact match", + "data": { "type": "string" }, + "valid": false + }, { "description": "match the enum exactly", "data": { "$ref": "#/definitions/a_string" },