summaryrefslogtreecommitdiff
path: root/json
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2021-08-24 14:25:32 +0100
committerJulian Berman <Julian@GrayVines.com>2021-08-24 14:25:32 +0100
commit8130dbf8b875f2bbbffcd85a50d25824aa73e086 (patch)
treea9d782c329d19aebfb6683c14f7c578e82ba2f03 /json
parent57351a3f63bba6126c38ba7f428a524edc53841d (diff)
parent6cf6ff85b7cf595609a10267a85d354202e3b2f0 (diff)
downloadjsonschema-8130dbf8b875f2bbbffcd85a50d25824aa73e086.tar.gz
Merge commit '6cf6ff85b7cf595609a10267a85d354202e3b2f0'
* commit '6cf6ff85b7cf595609a10267a85d354202e3b2f0': Squashed 'json/' changes from eb619047f..ab0b1ae71
Diffstat (limited to 'json')
-rw-r--r--json/tests/draft-future/optional/bignum.json34
-rw-r--r--json/tests/draft-future/optional/format/date.json24
-rw-r--r--json/tests/draft-future/optional/format/duration.json182
-rw-r--r--json/tests/draft-future/optional/format/time.json66
-rw-r--r--json/tests/draft2019-09/optional/bignum.json34
-rw-r--r--json/tests/draft2019-09/optional/format/date.json24
-rw-r--r--json/tests/draft2019-09/optional/format/duration.json182
-rw-r--r--json/tests/draft2019-09/optional/format/time.json66
-rw-r--r--json/tests/draft2020-12/optional/bignum.json34
-rw-r--r--json/tests/draft2020-12/optional/format/date.json24
-rw-r--r--json/tests/draft2020-12/optional/format/duration.json182
-rw-r--r--json/tests/draft2020-12/optional/format/time.json66
-rw-r--r--json/tests/draft4/optional/bignum.json34
-rw-r--r--json/tests/draft6/optional/bignum.json34
-rw-r--r--json/tests/draft7/optional/bignum.json34
-rw-r--r--json/tests/draft7/optional/format/date.json24
-rw-r--r--json/tests/draft7/optional/format/time.json66
17 files changed, 679 insertions, 431 deletions
diff --git a/json/tests/draft-future/optional/bignum.json b/json/tests/draft-future/optional/bignum.json
index fac275e..3f49226 100644
--- a/json/tests/draft-future/optional/bignum.json
+++ b/json/tests/draft-future/optional/bignum.json
@@ -1,30 +1,13 @@
[
{
"description": "integer",
- "schema": {"type": "integer"},
+ "schema": { "type": "integer" },
"tests": [
{
"description": "a bignum is an integer",
"data": 12345678910111213141516171819202122232425262728293031,
"valid": true
- }
- ]
- },
- {
- "description": "number",
- "schema": {"type": "number"},
- "tests": [
- {
- "description": "a bignum is a number",
- "data": 98249283749234923498293171823948729348710298301928331,
- "valid": true
- }
- ]
- },
- {
- "description": "integer",
- "schema": {"type": "integer"},
- "tests": [
+ },
{
"description": "a negative bignum is an integer",
"data": -12345678910111213141516171819202122232425262728293031,
@@ -34,9 +17,14 @@
},
{
"description": "number",
- "schema": {"type": "number"},
+ "schema": { "type": "number" },
"tests": [
{
+ "description": "a bignum is a number",
+ "data": 98249283749234923498293171823948729348710298301928331,
+ "valid": true
+ },
+ {
"description": "a negative bignum is a number",
"data": -98249283749234923498293171823948729348710298301928331,
"valid": true
@@ -45,7 +33,7 @@
},
{
"description": "string",
- "schema": {"type": "string"},
+ "schema": { "type": "string" },
"tests": [
{
"description": "a bignum is not a string",
@@ -56,7 +44,7 @@
},
{
"description": "integer comparison",
- "schema": {"maximum": 18446744073709551615},
+ "schema": { "maximum": 18446744073709551615 },
"tests": [
{
"description": "comparison works for high numbers",
@@ -80,7 +68,7 @@
},
{
"description": "integer comparison",
- "schema": {"minimum": -18446744073709551615},
+ "schema": { "minimum": -18446744073709551615 },
"tests": [
{
"description": "comparison works for very negative numbers",
diff --git a/json/tests/draft-future/optional/format/date.json b/json/tests/draft-future/optional/format/date.json
index 554fe54..00365fa 100644
--- a/json/tests/draft-future/optional/format/date.json
+++ b/json/tests/draft-future/optional/format/date.json
@@ -154,14 +154,34 @@
"valid": false
},
{
- "description": "invalidates non-padded month dates",
+ "description": "non-padded month dates are not valid",
"data": "1998-1-20",
"valid": false
},
{
- "description": "invalidates non-padded day dates",
+ "description": "non-padded day dates are not valid",
"data": "1998-01-1",
"valid": false
+ },
+ {
+ "description": "invalid month",
+ "data": "1998-13-01",
+ "valid": false
+ },
+ {
+ "description": "invalid month-day combination",
+ "data": "1998-04-31",
+ "valid": false
+ },
+ {
+ "description": "2021 is not a leap year",
+ "data": "2021-02-29",
+ "valid": false
+ },
+ {
+ "description": "2020 is a leap year",
+ "data": "2020-02-29",
+ "valid": true
}
]
}
diff --git a/json/tests/draft-future/optional/format/duration.json b/json/tests/draft-future/optional/format/duration.json
index 4514738..816ca4a 100644
--- a/json/tests/draft-future/optional/format/duration.json
+++ b/json/tests/draft-future/optional/format/duration.json
@@ -1,93 +1,93 @@
[
- {
- "description": "validation of duration strings",
- "schema": {"format": "duration"},
- "tests": [
- {
- "description": "a valid duration string",
- "data": "P4DT12H30M5S",
- "valid": true
- },
- {
- "description": "an invalid duration string",
- "data": "PT1D",
- "valid": false
- },
- {
- "description": "no elements present",
- "data": "P",
- "valid": false
- },
- {
- "description": "no time elements present",
- "data": "P1YT",
- "valid": false
- },
- {
- "description": "no date or time elements present",
- "data": "PT",
- "valid": false
- },
- {
- "description": "elements out of order",
- "data": "P2D1Y",
- "valid": false
- },
- {
- "description": "missing time separator",
- "data": "P1D2H",
- "valid": false
- },
- {
- "description": "time element in the date position",
- "data": "P2S",
- "valid": false
- },
- {
- "description": "four years duration",
- "data": "P4Y",
- "valid": true
- },
- {
- "description": "zero time, in seconds",
- "data": "PT0S",
- "valid": true
- },
- {
- "description": "zero time, in days",
- "data": "P0D",
- "valid": true
- },
- {
- "description": "one month duration",
- "data": "P1M",
- "valid": true
- },
- {
- "description": "one minute duration",
- "data": "PT1M",
- "valid": true
- },
- {
- "description": "one and a half days, in hours",
- "data": "PT36H",
- "valid": true
- },
- {
- "description": "one and a half days, in days and hours",
- "data": "P1DT12H",
- "valid": true
- },
- {
- "description": "two weeks",
- "data": "P2W",
- "valid": true
- },
- {
- "description": "weeks cannot be combined with other units",
- "data": "P1Y2W",
- "valid": false
- }
- ]
- }
+ {
+ "description": "validation of duration strings",
+ "schema": {"format": "duration"},
+ "tests": [
+ {
+ "description": "a valid duration string",
+ "data": "P4DT12H30M5S",
+ "valid": true
+ },
+ {
+ "description": "an invalid duration string",
+ "data": "PT1D",
+ "valid": false
+ },
+ {
+ "description": "no elements present",
+ "data": "P",
+ "valid": false
+ },
+ {
+ "description": "no time elements present",
+ "data": "P1YT",
+ "valid": false
+ },
+ {
+ "description": "no date or time elements present",
+ "data": "PT",
+ "valid": false
+ },
+ {
+ "description": "elements out of order",
+ "data": "P2D1Y",
+ "valid": false
+ },
+ {
+ "description": "missing time separator",
+ "data": "P1D2H",
+ "valid": false
+ },
+ {
+ "description": "time element in the date position",
+ "data": "P2S",
+ "valid": false
+ },
+ {
+ "description": "four years duration",
+ "data": "P4Y",
+ "valid": true
+ },
+ {
+ "description": "zero time, in seconds",
+ "data": "PT0S",
+ "valid": true
+ },
+ {
+ "description": "zero time, in days",
+ "data": "P0D",
+ "valid": true
+ },
+ {
+ "description": "one month duration",
+ "data": "P1M",
+ "valid": true
+ },
+ {
+ "description": "one minute duration",
+ "data": "PT1M",
+ "valid": true
+ },
+ {
+ "description": "one and a half days, in hours",
+ "data": "PT36H",
+ "valid": true
+ },
+ {
+ "description": "one and a half days, in days and hours",
+ "data": "P1DT12H",
+ "valid": true
+ },
+ {
+ "description": "two weeks",
+ "data": "P2W",
+ "valid": true
+ },
+ {
+ "description": "weeks cannot be combined with other units",
+ "data": "P1Y2W",
+ "valid": false
+ }
+ ]
+ }
]
diff --git a/json/tests/draft-future/optional/format/time.json b/json/tests/draft-future/optional/format/time.json
index 74e8bf9..6a72765 100644
--- a/json/tests/draft-future/optional/format/time.json
+++ b/json/tests/draft-future/optional/format/time.json
@@ -9,16 +9,76 @@
"valid": true
},
{
- "description": "a valid time string with leap second",
+ "description": "a valid time string with leap second, Zulu",
"data": "23:59:60Z",
"valid": true
},
{
- "description": "a valid time string with leap second with offset",
+ "description": "invalid leap second, Zulu (wrong hour)",
+ "data": "22:59:60Z",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, Zulu (wrong minute)",
+ "data": "23:58:60Z",
+ "valid": false
+ },
+ {
+ "description": "valid leap second, zero time-offset",
+ "data": "23:59:60+00:00",
+ "valid": true
+ },
+ {
+ "description": "invalid leap second, zero time-offset (wrong hour)",
+ "data": "22:59:60+00:00",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, zero time-offset (wrong minute)",
+ "data": "23:58:60+00:00",
+ "valid": false
+ },
+ {
+ "description": "valid leap second, positive time-offset",
+ "data": "01:29:60+01:30",
+ "valid": true
+ },
+ {
+ "description": "valid leap second, large positive time-offset",
+ "data": "23:29:60+23:30",
+ "valid": true
+ },
+ {
+ "description": "invalid leap second, positive time-offset (wrong hour)",
+ "data": "23:59:60+01:00",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, positive time-offset (wrong minute)",
+ "data": "23:59:60+00:30",
+ "valid": false
+ },
+ {
+ "description": "valid leap second, negative time-offset",
"data": "15:59:60-08:00",
"valid": true
},
{
+ "description": "valid leap second, large negative time-offset",
+ "data": "00:29:60-23:30",
+ "valid": true
+ },
+ {
+ "description": "invalid leap second, negative time-offset (wrong hour)",
+ "data": "23:59:60-01:00",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, negative time-offset (wrong minute)",
+ "data": "23:59:60-00:30",
+ "valid": false
+ },
+ {
"description": "a valid time string with second fraction",
"data": "23:20:50.52Z",
"valid": true
@@ -84,7 +144,7 @@
"valid": false
},
{
- "description": "an invalid time string",
+ "description": "an invalid offset indicator",
"data": "08:30:06 PST",
"valid": false
},
diff --git a/json/tests/draft2019-09/optional/bignum.json b/json/tests/draft2019-09/optional/bignum.json
index fac275e..3f49226 100644
--- a/json/tests/draft2019-09/optional/bignum.json
+++ b/json/tests/draft2019-09/optional/bignum.json
@@ -1,30 +1,13 @@
[
{
"description": "integer",
- "schema": {"type": "integer"},
+ "schema": { "type": "integer" },
"tests": [
{
"description": "a bignum is an integer",
"data": 12345678910111213141516171819202122232425262728293031,
"valid": true
- }
- ]
- },
- {
- "description": "number",
- "schema": {"type": "number"},
- "tests": [
- {
- "description": "a bignum is a number",
- "data": 98249283749234923498293171823948729348710298301928331,
- "valid": true
- }
- ]
- },
- {
- "description": "integer",
- "schema": {"type": "integer"},
- "tests": [
+ },
{
"description": "a negative bignum is an integer",
"data": -12345678910111213141516171819202122232425262728293031,
@@ -34,9 +17,14 @@
},
{
"description": "number",
- "schema": {"type": "number"},
+ "schema": { "type": "number" },
"tests": [
{
+ "description": "a bignum is a number",
+ "data": 98249283749234923498293171823948729348710298301928331,
+ "valid": true
+ },
+ {
"description": "a negative bignum is a number",
"data": -98249283749234923498293171823948729348710298301928331,
"valid": true
@@ -45,7 +33,7 @@
},
{
"description": "string",
- "schema": {"type": "string"},
+ "schema": { "type": "string" },
"tests": [
{
"description": "a bignum is not a string",
@@ -56,7 +44,7 @@
},
{
"description": "integer comparison",
- "schema": {"maximum": 18446744073709551615},
+ "schema": { "maximum": 18446744073709551615 },
"tests": [
{
"description": "comparison works for high numbers",
@@ -80,7 +68,7 @@
},
{
"description": "integer comparison",
- "schema": {"minimum": -18446744073709551615},
+ "schema": { "minimum": -18446744073709551615 },
"tests": [
{
"description": "comparison works for very negative numbers",
diff --git a/json/tests/draft2019-09/optional/format/date.json b/json/tests/draft2019-09/optional/format/date.json
index 554fe54..00365fa 100644
--- a/json/tests/draft2019-09/optional/format/date.json
+++ b/json/tests/draft2019-09/optional/format/date.json
@@ -154,14 +154,34 @@
"valid": false
},
{
- "description": "invalidates non-padded month dates",
+ "description": "non-padded month dates are not valid",
"data": "1998-1-20",
"valid": false
},
{
- "description": "invalidates non-padded day dates",
+ "description": "non-padded day dates are not valid",
"data": "1998-01-1",
"valid": false
+ },
+ {
+ "description": "invalid month",
+ "data": "1998-13-01",
+ "valid": false
+ },
+ {
+ "description": "invalid month-day combination",
+ "data": "1998-04-31",
+ "valid": false
+ },
+ {
+ "description": "2021 is not a leap year",
+ "data": "2021-02-29",
+ "valid": false
+ },
+ {
+ "description": "2020 is a leap year",
+ "data": "2020-02-29",
+ "valid": true
}
]
}
diff --git a/json/tests/draft2019-09/optional/format/duration.json b/json/tests/draft2019-09/optional/format/duration.json
index 4514738..816ca4a 100644
--- a/json/tests/draft2019-09/optional/format/duration.json
+++ b/json/tests/draft2019-09/optional/format/duration.json
@@ -1,93 +1,93 @@
[
- {
- "description": "validation of duration strings",
- "schema": {"format": "duration"},
- "tests": [
- {
- "description": "a valid duration string",
- "data": "P4DT12H30M5S",
- "valid": true
- },
- {
- "description": "an invalid duration string",
- "data": "PT1D",
- "valid": false
- },
- {
- "description": "no elements present",
- "data": "P",
- "valid": false
- },
- {
- "description": "no time elements present",
- "data": "P1YT",
- "valid": false
- },
- {
- "description": "no date or time elements present",
- "data": "PT",
- "valid": false
- },
- {
- "description": "elements out of order",
- "data": "P2D1Y",
- "valid": false
- },
- {
- "description": "missing time separator",
- "data": "P1D2H",
- "valid": false
- },
- {
- "description": "time element in the date position",
- "data": "P2S",
- "valid": false
- },
- {
- "description": "four years duration",
- "data": "P4Y",
- "valid": true
- },
- {
- "description": "zero time, in seconds",
- "data": "PT0S",
- "valid": true
- },
- {
- "description": "zero time, in days",
- "data": "P0D",
- "valid": true
- },
- {
- "description": "one month duration",
- "data": "P1M",
- "valid": true
- },
- {
- "description": "one minute duration",
- "data": "PT1M",
- "valid": true
- },
- {
- "description": "one and a half days, in hours",
- "data": "PT36H",
- "valid": true
- },
- {
- "description": "one and a half days, in days and hours",
- "data": "P1DT12H",
- "valid": true
- },
- {
- "description": "two weeks",
- "data": "P2W",
- "valid": true
- },
- {
- "description": "weeks cannot be combined with other units",
- "data": "P1Y2W",
- "valid": false
- }
- ]
- }
+ {
+ "description": "validation of duration strings",
+ "schema": {"format": "duration"},
+ "tests": [
+ {
+ "description": "a valid duration string",
+ "data": "P4DT12H30M5S",
+ "valid": true
+ },
+ {
+ "description": "an invalid duration string",
+ "data": "PT1D",
+ "valid": false
+ },
+ {
+ "description": "no elements present",
+ "data": "P",
+ "valid": false
+ },
+ {
+ "description": "no time elements present",
+ "data": "P1YT",
+ "valid": false
+ },
+ {
+ "description": "no date or time elements present",
+ "data": "PT",
+ "valid": false
+ },
+ {
+ "description": "elements out of order",
+ "data": "P2D1Y",
+ "valid": false
+ },
+ {
+ "description": "missing time separator",
+ "data": "P1D2H",
+ "valid": false
+ },
+ {
+ "description": "time element in the date position",
+ "data": "P2S",
+ "valid": false
+ },
+ {
+ "description": "four years duration",
+ "data": "P4Y",
+ "valid": true
+ },
+ {
+ "description": "zero time, in seconds",
+ "data": "PT0S",
+ "valid": true
+ },
+ {
+ "description": "zero time, in days",
+ "data": "P0D",
+ "valid": true
+ },
+ {
+ "description": "one month duration",
+ "data": "P1M",
+ "valid": true
+ },
+ {
+ "description": "one minute duration",
+ "data": "PT1M",
+ "valid": true
+ },
+ {
+ "description": "one and a half days, in hours",
+ "data": "PT36H",
+ "valid": true
+ },
+ {
+ "description": "one and a half days, in days and hours",
+ "data": "P1DT12H",
+ "valid": true
+ },
+ {
+ "description": "two weeks",
+ "data": "P2W",
+ "valid": true
+ },
+ {
+ "description": "weeks cannot be combined with other units",
+ "data": "P1Y2W",
+ "valid": false
+ }
+ ]
+ }
]
diff --git a/json/tests/draft2019-09/optional/format/time.json b/json/tests/draft2019-09/optional/format/time.json
index 74e8bf9..6a72765 100644
--- a/json/tests/draft2019-09/optional/format/time.json
+++ b/json/tests/draft2019-09/optional/format/time.json
@@ -9,16 +9,76 @@
"valid": true
},
{
- "description": "a valid time string with leap second",
+ "description": "a valid time string with leap second, Zulu",
"data": "23:59:60Z",
"valid": true
},
{
- "description": "a valid time string with leap second with offset",
+ "description": "invalid leap second, Zulu (wrong hour)",
+ "data": "22:59:60Z",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, Zulu (wrong minute)",
+ "data": "23:58:60Z",
+ "valid": false
+ },
+ {
+ "description": "valid leap second, zero time-offset",
+ "data": "23:59:60+00:00",
+ "valid": true
+ },
+ {
+ "description": "invalid leap second, zero time-offset (wrong hour)",
+ "data": "22:59:60+00:00",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, zero time-offset (wrong minute)",
+ "data": "23:58:60+00:00",
+ "valid": false
+ },
+ {
+ "description": "valid leap second, positive time-offset",
+ "data": "01:29:60+01:30",
+ "valid": true
+ },
+ {
+ "description": "valid leap second, large positive time-offset",
+ "data": "23:29:60+23:30",
+ "valid": true
+ },
+ {
+ "description": "invalid leap second, positive time-offset (wrong hour)",
+ "data": "23:59:60+01:00",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, positive time-offset (wrong minute)",
+ "data": "23:59:60+00:30",
+ "valid": false
+ },
+ {
+ "description": "valid leap second, negative time-offset",
"data": "15:59:60-08:00",
"valid": true
},
{
+ "description": "valid leap second, large negative time-offset",
+ "data": "00:29:60-23:30",
+ "valid": true
+ },
+ {
+ "description": "invalid leap second, negative time-offset (wrong hour)",
+ "data": "23:59:60-01:00",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, negative time-offset (wrong minute)",
+ "data": "23:59:60-00:30",
+ "valid": false
+ },
+ {
"description": "a valid time string with second fraction",
"data": "23:20:50.52Z",
"valid": true
@@ -84,7 +144,7 @@
"valid": false
},
{
- "description": "an invalid time string",
+ "description": "an invalid offset indicator",
"data": "08:30:06 PST",
"valid": false
},
diff --git a/json/tests/draft2020-12/optional/bignum.json b/json/tests/draft2020-12/optional/bignum.json
index fac275e..3f49226 100644
--- a/json/tests/draft2020-12/optional/bignum.json
+++ b/json/tests/draft2020-12/optional/bignum.json
@@ -1,30 +1,13 @@
[
{
"description": "integer",
- "schema": {"type": "integer"},
+ "schema": { "type": "integer" },
"tests": [
{
"description": "a bignum is an integer",
"data": 12345678910111213141516171819202122232425262728293031,
"valid": true
- }
- ]
- },
- {
- "description": "number",
- "schema": {"type": "number"},
- "tests": [
- {
- "description": "a bignum is a number",
- "data": 98249283749234923498293171823948729348710298301928331,
- "valid": true
- }
- ]
- },
- {
- "description": "integer",
- "schema": {"type": "integer"},
- "tests": [
+ },
{
"description": "a negative bignum is an integer",
"data": -12345678910111213141516171819202122232425262728293031,
@@ -34,9 +17,14 @@
},
{
"description": "number",
- "schema": {"type": "number"},
+ "schema": { "type": "number" },
"tests": [
{
+ "description": "a bignum is a number",
+ "data": 98249283749234923498293171823948729348710298301928331,
+ "valid": true
+ },
+ {
"description": "a negative bignum is a number",
"data": -98249283749234923498293171823948729348710298301928331,
"valid": true
@@ -45,7 +33,7 @@
},
{
"description": "string",
- "schema": {"type": "string"},
+ "schema": { "type": "string" },
"tests": [
{
"description": "a bignum is not a string",
@@ -56,7 +44,7 @@
},
{
"description": "integer comparison",
- "schema": {"maximum": 18446744073709551615},
+ "schema": { "maximum": 18446744073709551615 },
"tests": [
{
"description": "comparison works for high numbers",
@@ -80,7 +68,7 @@
},
{
"description": "integer comparison",
- "schema": {"minimum": -18446744073709551615},
+ "schema": { "minimum": -18446744073709551615 },
"tests": [
{
"description": "comparison works for very negative numbers",
diff --git a/json/tests/draft2020-12/optional/format/date.json b/json/tests/draft2020-12/optional/format/date.json
index 554fe54..00365fa 100644
--- a/json/tests/draft2020-12/optional/format/date.json
+++ b/json/tests/draft2020-12/optional/format/date.json
@@ -154,14 +154,34 @@
"valid": false
},
{
- "description": "invalidates non-padded month dates",
+ "description": "non-padded month dates are not valid",
"data": "1998-1-20",
"valid": false
},
{
- "description": "invalidates non-padded day dates",
+ "description": "non-padded day dates are not valid",
"data": "1998-01-1",
"valid": false
+ },
+ {
+ "description": "invalid month",
+ "data": "1998-13-01",
+ "valid": false
+ },
+ {
+ "description": "invalid month-day combination",
+ "data": "1998-04-31",
+ "valid": false
+ },
+ {
+ "description": "2021 is not a leap year",
+ "data": "2021-02-29",
+ "valid": false
+ },
+ {
+ "description": "2020 is a leap year",
+ "data": "2020-02-29",
+ "valid": true
}
]
}
diff --git a/json/tests/draft2020-12/optional/format/duration.json b/json/tests/draft2020-12/optional/format/duration.json
index 4514738..816ca4a 100644
--- a/json/tests/draft2020-12/optional/format/duration.json
+++ b/json/tests/draft2020-12/optional/format/duration.json
@@ -1,93 +1,93 @@
[
- {
- "description": "validation of duration strings",
- "schema": {"format": "duration"},
- "tests": [
- {
- "description": "a valid duration string",
- "data": "P4DT12H30M5S",
- "valid": true
- },
- {
- "description": "an invalid duration string",
- "data": "PT1D",
- "valid": false
- },
- {
- "description": "no elements present",
- "data": "P",
- "valid": false
- },
- {
- "description": "no time elements present",
- "data": "P1YT",
- "valid": false
- },
- {
- "description": "no date or time elements present",
- "data": "PT",
- "valid": false
- },
- {
- "description": "elements out of order",
- "data": "P2D1Y",
- "valid": false
- },
- {
- "description": "missing time separator",
- "data": "P1D2H",
- "valid": false
- },
- {
- "description": "time element in the date position",
- "data": "P2S",
- "valid": false
- },
- {
- "description": "four years duration",
- "data": "P4Y",
- "valid": true
- },
- {
- "description": "zero time, in seconds",
- "data": "PT0S",
- "valid": true
- },
- {
- "description": "zero time, in days",
- "data": "P0D",
- "valid": true
- },
- {
- "description": "one month duration",
- "data": "P1M",
- "valid": true
- },
- {
- "description": "one minute duration",
- "data": "PT1M",
- "valid": true
- },
- {
- "description": "one and a half days, in hours",
- "data": "PT36H",
- "valid": true
- },
- {
- "description": "one and a half days, in days and hours",
- "data": "P1DT12H",
- "valid": true
- },
- {
- "description": "two weeks",
- "data": "P2W",
- "valid": true
- },
- {
- "description": "weeks cannot be combined with other units",
- "data": "P1Y2W",
- "valid": false
- }
- ]
- }
+ {
+ "description": "validation of duration strings",
+ "schema": {"format": "duration"},
+ "tests": [
+ {
+ "description": "a valid duration string",
+ "data": "P4DT12H30M5S",
+ "valid": true
+ },
+ {
+ "description": "an invalid duration string",
+ "data": "PT1D",
+ "valid": false
+ },
+ {
+ "description": "no elements present",
+ "data": "P",
+ "valid": false
+ },
+ {
+ "description": "no time elements present",
+ "data": "P1YT",
+ "valid": false
+ },
+ {
+ "description": "no date or time elements present",
+ "data": "PT",
+ "valid": false
+ },
+ {
+ "description": "elements out of order",
+ "data": "P2D1Y",
+ "valid": false
+ },
+ {
+ "description": "missing time separator",
+ "data": "P1D2H",
+ "valid": false
+ },
+ {
+ "description": "time element in the date position",
+ "data": "P2S",
+ "valid": false
+ },
+ {
+ "description": "four years duration",
+ "data": "P4Y",
+ "valid": true
+ },
+ {
+ "description": "zero time, in seconds",
+ "data": "PT0S",
+ "valid": true
+ },
+ {
+ "description": "zero time, in days",
+ "data": "P0D",
+ "valid": true
+ },
+ {
+ "description": "one month duration",
+ "data": "P1M",
+ "valid": true
+ },
+ {
+ "description": "one minute duration",
+ "data": "PT1M",
+ "valid": true
+ },
+ {
+ "description": "one and a half days, in hours",
+ "data": "PT36H",
+ "valid": true
+ },
+ {
+ "description": "one and a half days, in days and hours",
+ "data": "P1DT12H",
+ "valid": true
+ },
+ {
+ "description": "two weeks",
+ "data": "P2W",
+ "valid": true
+ },
+ {
+ "description": "weeks cannot be combined with other units",
+ "data": "P1Y2W",
+ "valid": false
+ }
+ ]
+ }
]
diff --git a/json/tests/draft2020-12/optional/format/time.json b/json/tests/draft2020-12/optional/format/time.json
index 74e8bf9..6a72765 100644
--- a/json/tests/draft2020-12/optional/format/time.json
+++ b/json/tests/draft2020-12/optional/format/time.json
@@ -9,16 +9,76 @@
"valid": true
},
{
- "description": "a valid time string with leap second",
+ "description": "a valid time string with leap second, Zulu",
"data": "23:59:60Z",
"valid": true
},
{
- "description": "a valid time string with leap second with offset",
+ "description": "invalid leap second, Zulu (wrong hour)",
+ "data": "22:59:60Z",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, Zulu (wrong minute)",
+ "data": "23:58:60Z",
+ "valid": false
+ },
+ {
+ "description": "valid leap second, zero time-offset",
+ "data": "23:59:60+00:00",
+ "valid": true
+ },
+ {
+ "description": "invalid leap second, zero time-offset (wrong hour)",
+ "data": "22:59:60+00:00",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, zero time-offset (wrong minute)",
+ "data": "23:58:60+00:00",
+ "valid": false
+ },
+ {
+ "description": "valid leap second, positive time-offset",
+ "data": "01:29:60+01:30",
+ "valid": true
+ },
+ {
+ "description": "valid leap second, large positive time-offset",
+ "data": "23:29:60+23:30",
+ "valid": true
+ },
+ {
+ "description": "invalid leap second, positive time-offset (wrong hour)",
+ "data": "23:59:60+01:00",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, positive time-offset (wrong minute)",
+ "data": "23:59:60+00:30",
+ "valid": false
+ },
+ {
+ "description": "valid leap second, negative time-offset",
"data": "15:59:60-08:00",
"valid": true
},
{
+ "description": "valid leap second, large negative time-offset",
+ "data": "00:29:60-23:30",
+ "valid": true
+ },
+ {
+ "description": "invalid leap second, negative time-offset (wrong hour)",
+ "data": "23:59:60-01:00",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, negative time-offset (wrong minute)",
+ "data": "23:59:60-00:30",
+ "valid": false
+ },
+ {
"description": "a valid time string with second fraction",
"data": "23:20:50.52Z",
"valid": true
@@ -84,7 +144,7 @@
"valid": false
},
{
- "description": "an invalid time string",
+ "description": "an invalid offset indicator",
"data": "08:30:06 PST",
"valid": false
},
diff --git a/json/tests/draft4/optional/bignum.json b/json/tests/draft4/optional/bignum.json
index ccc7c17..7a622de 100644
--- a/json/tests/draft4/optional/bignum.json
+++ b/json/tests/draft4/optional/bignum.json
@@ -1,30 +1,13 @@
[
{
"description": "integer",
- "schema": {"type": "integer"},
+ "schema": { "type": "integer" },
"tests": [
{
"description": "a bignum is an integer",
"data": 12345678910111213141516171819202122232425262728293031,
"valid": true
- }
- ]
- },
- {
- "description": "number",
- "schema": {"type": "number"},
- "tests": [
- {
- "description": "a bignum is a number",
- "data": 98249283749234923498293171823948729348710298301928331,
- "valid": true
- }
- ]
- },
- {
- "description": "integer",
- "schema": {"type": "integer"},
- "tests": [
+ },
{
"description": "a negative bignum is an integer",
"data": -12345678910111213141516171819202122232425262728293031,
@@ -34,9 +17,14 @@
},
{
"description": "number",
- "schema": {"type": "number"},
+ "schema": { "type": "number" },
"tests": [
{
+ "description": "a bignum is a number",
+ "data": 98249283749234923498293171823948729348710298301928331,
+ "valid": true
+ },
+ {
"description": "a negative bignum is a number",
"data": -98249283749234923498293171823948729348710298301928331,
"valid": true
@@ -45,7 +33,7 @@
},
{
"description": "string",
- "schema": {"type": "string"},
+ "schema": { "type": "string" },
"tests": [
{
"description": "a bignum is not a string",
@@ -56,7 +44,7 @@
},
{
"description": "integer comparison",
- "schema": {"maximum": 18446744073709551615},
+ "schema": { "maximum": 18446744073709551615 },
"tests": [
{
"description": "comparison works for high numbers",
@@ -81,7 +69,7 @@
},
{
"description": "integer comparison",
- "schema": {"minimum": -18446744073709551615},
+ "schema": { "minimum": -18446744073709551615 },
"tests": [
{
"description": "comparison works for very negative numbers",
diff --git a/json/tests/draft6/optional/bignum.json b/json/tests/draft6/optional/bignum.json
index fac275e..3f49226 100644
--- a/json/tests/draft6/optional/bignum.json
+++ b/json/tests/draft6/optional/bignum.json
@@ -1,30 +1,13 @@
[
{
"description": "integer",
- "schema": {"type": "integer"},
+ "schema": { "type": "integer" },
"tests": [
{
"description": "a bignum is an integer",
"data": 12345678910111213141516171819202122232425262728293031,
"valid": true
- }
- ]
- },
- {
- "description": "number",
- "schema": {"type": "number"},
- "tests": [
- {
- "description": "a bignum is a number",
- "data": 98249283749234923498293171823948729348710298301928331,
- "valid": true
- }
- ]
- },
- {
- "description": "integer",
- "schema": {"type": "integer"},
- "tests": [
+ },
{
"description": "a negative bignum is an integer",
"data": -12345678910111213141516171819202122232425262728293031,
@@ -34,9 +17,14 @@
},
{
"description": "number",
- "schema": {"type": "number"},
+ "schema": { "type": "number" },
"tests": [
{
+ "description": "a bignum is a number",
+ "data": 98249283749234923498293171823948729348710298301928331,
+ "valid": true
+ },
+ {
"description": "a negative bignum is a number",
"data": -98249283749234923498293171823948729348710298301928331,
"valid": true
@@ -45,7 +33,7 @@
},
{
"description": "string",
- "schema": {"type": "string"},
+ "schema": { "type": "string" },
"tests": [
{
"description": "a bignum is not a string",
@@ -56,7 +44,7 @@
},
{
"description": "integer comparison",
- "schema": {"maximum": 18446744073709551615},
+ "schema": { "maximum": 18446744073709551615 },
"tests": [
{
"description": "comparison works for high numbers",
@@ -80,7 +68,7 @@
},
{
"description": "integer comparison",
- "schema": {"minimum": -18446744073709551615},
+ "schema": { "minimum": -18446744073709551615 },
"tests": [
{
"description": "comparison works for very negative numbers",
diff --git a/json/tests/draft7/optional/bignum.json b/json/tests/draft7/optional/bignum.json
index fac275e..3f49226 100644
--- a/json/tests/draft7/optional/bignum.json
+++ b/json/tests/draft7/optional/bignum.json
@@ -1,30 +1,13 @@
[
{
"description": "integer",
- "schema": {"type": "integer"},
+ "schema": { "type": "integer" },
"tests": [
{
"description": "a bignum is an integer",
"data": 12345678910111213141516171819202122232425262728293031,
"valid": true
- }
- ]
- },
- {
- "description": "number",
- "schema": {"type": "number"},
- "tests": [
- {
- "description": "a bignum is a number",
- "data": 98249283749234923498293171823948729348710298301928331,
- "valid": true
- }
- ]
- },
- {
- "description": "integer",
- "schema": {"type": "integer"},
- "tests": [
+ },
{
"description": "a negative bignum is an integer",
"data": -12345678910111213141516171819202122232425262728293031,
@@ -34,9 +17,14 @@
},
{
"description": "number",
- "schema": {"type": "number"},
+ "schema": { "type": "number" },
"tests": [
{
+ "description": "a bignum is a number",
+ "data": 98249283749234923498293171823948729348710298301928331,
+ "valid": true
+ },
+ {
"description": "a negative bignum is a number",
"data": -98249283749234923498293171823948729348710298301928331,
"valid": true
@@ -45,7 +33,7 @@
},
{
"description": "string",
- "schema": {"type": "string"},
+ "schema": { "type": "string" },
"tests": [
{
"description": "a bignum is not a string",
@@ -56,7 +44,7 @@
},
{
"description": "integer comparison",
- "schema": {"maximum": 18446744073709551615},
+ "schema": { "maximum": 18446744073709551615 },
"tests": [
{
"description": "comparison works for high numbers",
@@ -80,7 +68,7 @@
},
{
"description": "integer comparison",
- "schema": {"minimum": -18446744073709551615},
+ "schema": { "minimum": -18446744073709551615 },
"tests": [
{
"description": "comparison works for very negative numbers",
diff --git a/json/tests/draft7/optional/format/date.json b/json/tests/draft7/optional/format/date.json
index 554fe54..00365fa 100644
--- a/json/tests/draft7/optional/format/date.json
+++ b/json/tests/draft7/optional/format/date.json
@@ -154,14 +154,34 @@
"valid": false
},
{
- "description": "invalidates non-padded month dates",
+ "description": "non-padded month dates are not valid",
"data": "1998-1-20",
"valid": false
},
{
- "description": "invalidates non-padded day dates",
+ "description": "non-padded day dates are not valid",
"data": "1998-01-1",
"valid": false
+ },
+ {
+ "description": "invalid month",
+ "data": "1998-13-01",
+ "valid": false
+ },
+ {
+ "description": "invalid month-day combination",
+ "data": "1998-04-31",
+ "valid": false
+ },
+ {
+ "description": "2021 is not a leap year",
+ "data": "2021-02-29",
+ "valid": false
+ },
+ {
+ "description": "2020 is a leap year",
+ "data": "2020-02-29",
+ "valid": true
}
]
}
diff --git a/json/tests/draft7/optional/format/time.json b/json/tests/draft7/optional/format/time.json
index 74e8bf9..6a72765 100644
--- a/json/tests/draft7/optional/format/time.json
+++ b/json/tests/draft7/optional/format/time.json
@@ -9,16 +9,76 @@
"valid": true
},
{
- "description": "a valid time string with leap second",
+ "description": "a valid time string with leap second, Zulu",
"data": "23:59:60Z",
"valid": true
},
{
- "description": "a valid time string with leap second with offset",
+ "description": "invalid leap second, Zulu (wrong hour)",
+ "data": "22:59:60Z",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, Zulu (wrong minute)",
+ "data": "23:58:60Z",
+ "valid": false
+ },
+ {
+ "description": "valid leap second, zero time-offset",
+ "data": "23:59:60+00:00",
+ "valid": true
+ },
+ {
+ "description": "invalid leap second, zero time-offset (wrong hour)",
+ "data": "22:59:60+00:00",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, zero time-offset (wrong minute)",
+ "data": "23:58:60+00:00",
+ "valid": false
+ },
+ {
+ "description": "valid leap second, positive time-offset",
+ "data": "01:29:60+01:30",
+ "valid": true
+ },
+ {
+ "description": "valid leap second, large positive time-offset",
+ "data": "23:29:60+23:30",
+ "valid": true
+ },
+ {
+ "description": "invalid leap second, positive time-offset (wrong hour)",
+ "data": "23:59:60+01:00",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, positive time-offset (wrong minute)",
+ "data": "23:59:60+00:30",
+ "valid": false
+ },
+ {
+ "description": "valid leap second, negative time-offset",
"data": "15:59:60-08:00",
"valid": true
},
{
+ "description": "valid leap second, large negative time-offset",
+ "data": "00:29:60-23:30",
+ "valid": true
+ },
+ {
+ "description": "invalid leap second, negative time-offset (wrong hour)",
+ "data": "23:59:60-01:00",
+ "valid": false
+ },
+ {
+ "description": "invalid leap second, negative time-offset (wrong minute)",
+ "data": "23:59:60-00:30",
+ "valid": false
+ },
+ {
"description": "a valid time string with second fraction",
"data": "23:20:50.52Z",
"valid": true
@@ -84,7 +144,7 @@
"valid": false
},
{
- "description": "an invalid time string",
+ "description": "an invalid offset indicator",
"data": "08:30:06 PST",
"valid": false
},