From 934616aacc5cbba38643aaaa0df0f29fb999b45c Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Thu, 23 Nov 2023 09:31:02 +1300 Subject: [PATCH 1/3] split format tests between MAY and SHOULD requirements --- .../may/format-configured-assertion/README.md | 15 ++ .../date-time.json | 71 ++++++++ .../format-configured-assertion}/date.json | 105 ------------ .../format-configured-assertion/duration.json | 61 +++++++ .../format-configured-assertion/email.json | 41 +++++ .../format-configured-assertion/hostname.json | 56 ++++++ .../idn-email.json | 21 +++ .../idn-hostname.json | 150 ---------------- .../format-configured-assertion}/ipv4.json | 40 ----- .../format-configured-assertion}/ipv6.json | 85 --------- .../iri-reference.json | 21 +++ .../may/format-configured-assertion/iri.json | 31 ++++ .../json-pointer.json | 71 ++++++++ .../format-configured-assertion/regex.json | 16 ++ .../relative-json-pointer.json | 46 +++++ .../format-configured-assertion}/time.json | 90 ---------- .../uri-reference.json | 21 +++ .../uri-template.json | 16 ++ .../may/format-configured-assertion/uri.json | 46 +++++ .../may/format-configured-assertion/uuid.json | 46 +++++ .../format-configured-assertion/README.md | 15 ++ .../date-time.json | 60 ------- .../format-configured-assertion/date.json | 116 +++++++++++++ .../duration.json | 50 ------ .../format-configured-assertion}/email.json | 30 ---- .../hostname.json | 45 ----- .../idn-email.json | 10 -- .../idn-hostname.json | 161 ++++++++++++++++++ .../format-configured-assertion/ipv4.json | 51 ++++++ .../format-configured-assertion/ipv6.json | 96 +++++++++++ .../iri-reference.json | 10 -- .../format-configured-assertion}/iri.json | 20 --- .../json-pointer.json | 55 ------ .../format-configured-assertion}/regex.json | 5 - .../relative-json-pointer.json | 35 ---- .../format-configured-assertion/time.json | 101 +++++++++++ .../uri-reference.json | 10 -- .../uri-template.json | 5 - .../format-configured-assertion}/uri.json | 35 ---- .../format-configured-assertion}/uuid.json | 35 ---- 40 files changed, 1119 insertions(+), 875 deletions(-) create mode 100644 tests/draft-next/may/format-configured-assertion/README.md create mode 100644 tests/draft-next/may/format-configured-assertion/date-time.json rename tests/draft-next/{optional/format => may/format-configured-assertion}/date.json (57%) create mode 100644 tests/draft-next/may/format-configured-assertion/duration.json create mode 100644 tests/draft-next/may/format-configured-assertion/email.json create mode 100644 tests/draft-next/may/format-configured-assertion/hostname.json create mode 100644 tests/draft-next/may/format-configured-assertion/idn-email.json rename tests/draft-next/{optional/format => may/format-configured-assertion}/idn-hostname.json (57%) rename tests/draft-next/{optional/format => may/format-configured-assertion}/ipv4.json (59%) rename tests/draft-next/{optional/format => may/format-configured-assertion}/ipv6.json (60%) create mode 100644 tests/draft-next/may/format-configured-assertion/iri-reference.json create mode 100644 tests/draft-next/may/format-configured-assertion/iri.json create mode 100644 tests/draft-next/may/format-configured-assertion/json-pointer.json create mode 100644 tests/draft-next/may/format-configured-assertion/regex.json create mode 100644 tests/draft-next/may/format-configured-assertion/relative-json-pointer.json rename tests/draft-next/{optional/format => may/format-configured-assertion}/time.json (62%) create mode 100644 tests/draft-next/may/format-configured-assertion/uri-reference.json create mode 100644 tests/draft-next/may/format-configured-assertion/uri-template.json create mode 100644 tests/draft-next/may/format-configured-assertion/uri.json create mode 100644 tests/draft-next/may/format-configured-assertion/uuid.json create mode 100644 tests/draft-next/should/format-configured-assertion/README.md rename tests/draft-next/{optional/format => should/format-configured-assertion}/date-time.json (52%) create mode 100644 tests/draft-next/should/format-configured-assertion/date.json rename tests/draft-next/{optional/format => should/format-configured-assertion}/duration.json (61%) rename tests/draft-next/{optional/format => should/format-configured-assertion}/email.json (74%) rename tests/draft-next/{optional/format => should/format-configured-assertion}/hostname.json (60%) rename tests/draft-next/{optional/format => should/format-configured-assertion}/idn-email.json (83%) create mode 100644 tests/draft-next/should/format-configured-assertion/idn-hostname.json create mode 100644 tests/draft-next/should/format-configured-assertion/ipv4.json create mode 100644 tests/draft-next/should/format-configured-assertion/ipv6.json rename tests/draft-next/{optional/format => should/format-configured-assertion}/iri-reference.json (85%) rename tests/draft-next/{optional/format => should/format-configured-assertion}/iri.json (75%) rename tests/draft-next/{optional/format => should/format-configured-assertion}/json-pointer.json (70%) rename tests/draft-next/{optional/format => should/format-configured-assertion}/regex.json (88%) rename tests/draft-next/{optional/format => should/format-configured-assertion}/relative-json-pointer.json (63%) create mode 100644 tests/draft-next/should/format-configured-assertion/time.json rename tests/draft-next/{optional/format => should/format-configured-assertion}/uri-reference.json (85%) rename tests/draft-next/{optional/format => should/format-configured-assertion}/uri-template.json (90%) rename tests/draft-next/{optional/format => should/format-configured-assertion}/uri.json (74%) rename tests/draft-next/{optional/format => should/format-configured-assertion}/uuid.json (67%) diff --git a/tests/draft-next/may/format-configured-assertion/README.md b/tests/draft-next/may/format-configured-assertion/README.md new file mode 100644 index 00000000..bd1c9772 --- /dev/null +++ b/tests/draft-next/may/format-configured-assertion/README.md @@ -0,0 +1,15 @@ +This folder contains tests to cover the case when the `format-annotation` vocabulary is present, meaning `format` should not be validated, but the implementation is configured to validate it anyway. + +_Implementations must be configured to validate `format` when running these tests in order for the tests to be effective._ If the implementation does not support such a configuration, these tests may be skipped. + + +[Validation Section 7.2.1](https://json-schema.org/draft/2020-12/json-schema-validation#section-7.2.1) states + +> When the implementation is configured for assertion behavior, it: +> +> - SHOULD provide an implementation-specific best effort validation for each format attribute defined below; +> - MAY choose to implement validation of any or all format attributes as a no-op by always producing a validation result of true; + +The tests in herein cover the second point. As such, these test cases are invalid data for their respective formats, so validation is expected to fail. + +An implementation which returns a passing validation for these scenarios is permissible. \ No newline at end of file diff --git a/tests/draft-next/may/format-configured-assertion/date-time.json b/tests/draft-next/may/format-configured-assertion/date-time.json new file mode 100644 index 00000000..e7a44b2e --- /dev/null +++ b/tests/draft-next/may/format-configured-assertion/date-time.json @@ -0,0 +1,71 @@ +[ + { + "description": "validation of invalid date-time strings", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "date-time" + }, + "tests": [ + { + "description": "an invalid date-time past leap second, UTC", + "data": "1998-12-31T23:59:61Z", + "valid": false + }, + { + "description": "an invalid date-time with leap second on a wrong minute, UTC", + "data": "1998-12-31T23:58:60Z", + "valid": false + }, + { + "description": "an invalid date-time with leap second on a wrong hour, UTC", + "data": "1998-12-31T22:59:60Z", + "valid": false + }, + { + "description": "an invalid day in date-time string", + "data": "1990-02-31T15:59:59.123-08:00", + "valid": false + }, + { + "description": "an invalid offset in date-time string", + "data": "1990-12-31T15:59:59-24:00", + "valid": false + }, + { + "description": "an invalid closing Z after time-zone offset", + "data": "1963-06-19T08:30:06.28123+01:00Z", + "valid": false + }, + { + "description": "an invalid date-time string", + "data": "06/19/1963 08:30:06 PST", + "valid": false + }, + { + "description": "only RFC3339 not all of ISO 8601 are valid", + "data": "2013-350T01:01:01", + "valid": false + }, + { + "description": "invalid non-padded month dates", + "data": "1963-6-19T08:30:06.283185Z", + "valid": false + }, + { + "description": "invalid non-padded day dates", + "data": "1963-06-1T08:30:06.283185Z", + "valid": false + }, + { + "description": "invalid non-ASCII '৪' (a Bengali 4) in date portion", + "data": "1963-06-1৪T00:00:00Z", + "valid": false + }, + { + "description": "invalid non-ASCII '৪' (a Bengali 4) in time portion", + "data": "1963-06-11T0৪:00:00Z", + "valid": false + } + ] + } +] diff --git a/tests/draft-next/optional/format/date.json b/tests/draft-next/may/format-configured-assertion/date.json similarity index 57% rename from tests/draft-next/optional/format/date.json rename to tests/draft-next/may/format-configured-assertion/date.json index aa55555c..d8b7eac2 100644 --- a/tests/draft-next/optional/format/date.json +++ b/tests/draft-next/may/format-configured-assertion/date.json @@ -6,166 +6,66 @@ "format": "date" }, "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 date string", - "data": "1963-06-19", - "valid": true - }, - { - "description": "a valid date string with 31 days in January", - "data": "2020-01-31", - "valid": true - }, { "description": "a invalid date string with 32 days in January", "data": "2020-01-32", "valid": false }, - { - "description": "a valid date string with 28 days in February (normal)", - "data": "2021-02-28", - "valid": true - }, { "description": "a invalid date string with 29 days in February (normal)", "data": "2021-02-29", "valid": false }, - { - "description": "a valid date string with 29 days in February (leap)", - "data": "2020-02-29", - "valid": true - }, { "description": "a invalid date string with 30 days in February (leap)", "data": "2020-02-30", "valid": false }, - { - "description": "a valid date string with 31 days in March", - "data": "2020-03-31", - "valid": true - }, { "description": "a invalid date string with 32 days in March", "data": "2020-03-32", "valid": false }, - { - "description": "a valid date string with 30 days in April", - "data": "2020-04-30", - "valid": true - }, { "description": "a invalid date string with 31 days in April", "data": "2020-04-31", "valid": false }, - { - "description": "a valid date string with 31 days in May", - "data": "2020-05-31", - "valid": true - }, { "description": "a invalid date string with 32 days in May", "data": "2020-05-32", "valid": false }, - { - "description": "a valid date string with 30 days in June", - "data": "2020-06-30", - "valid": true - }, { "description": "a invalid date string with 31 days in June", "data": "2020-06-31", "valid": false }, - { - "description": "a valid date string with 31 days in July", - "data": "2020-07-31", - "valid": true - }, { "description": "a invalid date string with 32 days in July", "data": "2020-07-32", "valid": false }, - { - "description": "a valid date string with 31 days in August", - "data": "2020-08-31", - "valid": true - }, { "description": "a invalid date string with 32 days in August", "data": "2020-08-32", "valid": false }, - { - "description": "a valid date string with 30 days in September", - "data": "2020-09-30", - "valid": true - }, { "description": "a invalid date string with 31 days in September", "data": "2020-09-31", "valid": false }, - { - "description": "a valid date string with 31 days in October", - "data": "2020-10-31", - "valid": true - }, { "description": "a invalid date string with 32 days in October", "data": "2020-10-32", "valid": false }, - { - "description": "a valid date string with 30 days in November", - "data": "2020-11-30", - "valid": true - }, { "description": "a invalid date string with 31 days in November", "data": "2020-11-31", "valid": false }, - { - "description": "a valid date string with 31 days in December", - "data": "2020-12-31", - "valid": true - }, { "description": "a invalid date string with 32 days in December", "data": "2020-12-32", @@ -211,11 +111,6 @@ "data": "2021-02-29", "valid": false }, - { - "description": "2020 is a leap year", - "data": "2020-02-29", - "valid": true - }, { "description": "invalid non-ASCII '৪' (a Bengali 4)", "data": "1963-06-1৪", diff --git a/tests/draft-next/may/format-configured-assertion/duration.json b/tests/draft-next/may/format-configured-assertion/duration.json new file mode 100644 index 00000000..59ffbc89 --- /dev/null +++ b/tests/draft-next/may/format-configured-assertion/duration.json @@ -0,0 +1,61 @@ +[ + { + "description": "validation of duration strings", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "duration" + }, + "tests": [ + { + "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": "weeks cannot be combined with other units", + "data": "P1Y2W", + "valid": false + }, + { + "description": "invalid non-ASCII '২' (a Bengali 2)", + "data": "P২Y", + "valid": false + }, + { + "description": "element without unit", + "data": "P1", + "valid": false + } + ] + } +] diff --git a/tests/draft-next/may/format-configured-assertion/email.json b/tests/draft-next/may/format-configured-assertion/email.json new file mode 100644 index 00000000..1c154f88 --- /dev/null +++ b/tests/draft-next/may/format-configured-assertion/email.json @@ -0,0 +1,41 @@ +[ + { + "description": "validation of e-mail addresses", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "email" + }, + "tests": [ + { + "description": "an invalid e-mail address", + "data": "2962", + "valid": false + }, + { + "description": "dot before local part is not valid", + "data": ".test@example.com", + "valid": false + }, + { + "description": "dot after local part is not valid", + "data": "test.@example.com", + "valid": false + }, + { + "description": "two subsequent dots inside local part are not valid", + "data": "te..st@example.com", + "valid": false + }, + { + "description": "an invalid domain", + "data": "joe.bloggs@invalid=domain.com", + "valid": false + }, + { + "description": "an invalid IPv4-address-literal", + "data": "joe.bloggs@[127.0.0.300]", + "valid": false + } + ] + } +] diff --git a/tests/draft-next/may/format-configured-assertion/hostname.json b/tests/draft-next/may/format-configured-assertion/hostname.json new file mode 100644 index 00000000..40bfb8fc --- /dev/null +++ b/tests/draft-next/may/format-configured-assertion/hostname.json @@ -0,0 +1,56 @@ +[ + { + "description": "validation of host names", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "hostname" + }, + "tests": [ + { + "description": "a host name starting with an illegal character", + "data": "-a-host-name-that-starts-with--", + "valid": false + }, + { + "description": "a host name containing illegal characters", + "data": "not_a_valid_host_name", + "valid": false + }, + { + "description": "a host name with a component too long", + "data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component", + "valid": false + }, + { + "description": "starts with hyphen", + "data": "-hostname", + "valid": false + }, + { + "description": "ends with hyphen", + "data": "hostname-", + "valid": false + }, + { + "description": "starts with underscore", + "data": "_hostname", + "valid": false + }, + { + "description": "ends with underscore", + "data": "hostname_", + "valid": false + }, + { + "description": "contains underscore", + "data": "host_name", + "valid": false + }, + { + "description": "exceeds maximum label length", + "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com", + "valid": false + } + ] + } +] diff --git a/tests/draft-next/may/format-configured-assertion/idn-email.json b/tests/draft-next/may/format-configured-assertion/idn-email.json new file mode 100644 index 00000000..e57998d0 --- /dev/null +++ b/tests/draft-next/may/format-configured-assertion/idn-email.json @@ -0,0 +1,21 @@ +[ + { + "description": "validation of an internationalized e-mail addresses", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "idn-email" + }, + "tests": [ + { + "description": "an invalid idn e-mail address", + "data": "2962", + "valid": false + }, + { + "description": "an invalid e-mail address", + "data": "2962", + "valid": false + } + ] + } +] diff --git a/tests/draft-next/optional/format/idn-hostname.json b/tests/draft-next/may/format-configured-assertion/idn-hostname.json similarity index 57% rename from tests/draft-next/optional/format/idn-hostname.json rename to tests/draft-next/may/format-configured-assertion/idn-hostname.json index 109bf73c..af336b41 100644 --- a/tests/draft-next/optional/format/idn-hostname.json +++ b/tests/draft-next/may/format-configured-assertion/idn-hostname.json @@ -6,41 +6,6 @@ "format": "idn-hostname" }, "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 host name (example.test in Hangul)", - "data": "실례.테스트", - "valid": true - }, { "description": "illegal first char U+302E Hangul single dot tone mark", "data": "〮실례.테스트", @@ -62,12 +27,6 @@ "data": "-> $1.00 <--", "valid": false }, - { - "description": "valid Chinese Punycode", - "comment": "https://tools.ietf.org/html/rfc5890#section-2.3.2.1 https://tools.ietf.org/html/rfc5891#section-4.4", - "data": "xn--ihqwcrb4cv8a8dqg056pqjye", - "valid": true - }, { "description": "invalid Punycode", "comment": "https://tools.ietf.org/html/rfc5891#section-4.4 https://tools.ietf.org/html/rfc5890#section-2.3.2.1", @@ -116,18 +75,6 @@ "data": "\u0488hello", "valid": false }, - { - "description": "Exceptions that are PVALID, left-to-right chars", - "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6", - "data": "\u00df\u03c2\u0f0b\u3007", - "valid": true - }, - { - "description": "Exceptions that are PVALID, right-to-left chars", - "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6", - "data": "\u06fd\u06fe", - "valid": true - }, { "description": "Exceptions that are DISALLOWED, right-to-left chars", "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6", @@ -164,12 +111,6 @@ "data": "l\u00b7", "valid": false }, - { - "description": "MIDDLE DOT with surrounding 'l's", - "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3", - "data": "l\u00b7l", - "valid": true - }, { "description": "Greek KERAIA not followed by Greek", "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.4", @@ -182,12 +123,6 @@ "data": "\u03b1\u0375", "valid": false }, - { - "description": "Greek KERAIA followed by Greek", - "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.4", - "data": "\u03b1\u0375\u03b2", - "valid": true - }, { "description": "Hebrew GERESH not preceded by Hebrew", "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.5", @@ -200,12 +135,6 @@ "data": "\u05f3\u05d1", "valid": false }, - { - "description": "Hebrew GERESH preceded by Hebrew", - "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.5", - "data": "\u05d0\u05f3\u05d1", - "valid": true - }, { "description": "Hebrew GERSHAYIM not preceded by Hebrew", "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.6", @@ -218,12 +147,6 @@ "data": "\u05f4\u05d1", "valid": false }, - { - "description": "Hebrew GERSHAYIM preceded by Hebrew", - "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.6", - "data": "\u05d0\u05f4\u05d1", - "valid": true - }, { "description": "KATAKANA MIDDLE DOT with no Hiragana, Katakana, or Han", "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7", @@ -236,42 +159,12 @@ "data": "\u30fb", "valid": false }, - { - "description": "KATAKANA MIDDLE DOT with Hiragana", - "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7", - "data": "\u30fb\u3041", - "valid": true - }, - { - "description": "KATAKANA MIDDLE DOT with Katakana", - "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7", - "data": "\u30fb\u30a1", - "valid": true - }, - { - "description": "KATAKANA MIDDLE DOT with Han", - "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7", - "data": "\u30fb\u4e08", - "valid": true - }, { "description": "Arabic-Indic digits mixed with Extended Arabic-Indic digits", "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.8", "data": "\u0660\u06f0", "valid": false }, - { - "description": "Arabic-Indic digits not mixed with Extended Arabic-Indic digits", - "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.8", - "data": "\u0628\u0660\u0628", - "valid": true - }, - { - "description": "Extended Arabic-Indic digits not mixed with Arabic-Indic digits", - "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.9", - "data": "\u06f00", - "valid": true - }, { "description": "ZERO WIDTH JOINER not preceded by Virama", "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.2 https://www.unicode.org/review/pr-37.pdf", @@ -283,49 +176,6 @@ "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.2 https://www.unicode.org/review/pr-37.pdf", "data": "\u200d\u0937", "valid": false - }, - { - "description": "ZERO WIDTH JOINER preceded by Virama", - "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.2 https://www.unicode.org/review/pr-37.pdf", - "data": "\u0915\u094d\u200d\u0937", - "valid": true - }, - { - "description": "ZERO WIDTH NON-JOINER preceded by Virama", - "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1", - "data": "\u0915\u094d\u200c\u0937", - "valid": true - }, - { - "description": "ZERO WIDTH NON-JOINER not preceded by Virama but matches regexp", - "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1 https://www.w3.org/TR/alreq/#h_disjoining_enforcement", - "data": "\u0628\u064a\u200c\u0628\u064a", - "valid": true - }, - { - "description": "single label", - "data": "hostname", - "valid": true - }, - { - "description": "single label with hyphen", - "data": "host-name", - "valid": true - }, - { - "description": "single label with digits", - "data": "h0stn4me", - "valid": true - }, - { - "description": "single label starting with digit", - "data": "1host", - "valid": true - }, - { - "description": "single label ending with digit", - "data": "hostnam3", - "valid": true } ] } diff --git a/tests/draft-next/optional/format/ipv4.json b/tests/draft-next/may/format-configured-assertion/ipv4.json similarity index 59% rename from tests/draft-next/optional/format/ipv4.json rename to tests/draft-next/may/format-configured-assertion/ipv4.json index 2a4bc2b2..78822942 100644 --- a/tests/draft-next/optional/format/ipv4.json +++ b/tests/draft-next/may/format-configured-assertion/ipv4.json @@ -6,41 +6,6 @@ "format": "ipv4" }, "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 IP address", - "data": "192.168.0.1", - "valid": true - }, { "description": "an IP address with too many components", "data": "127.0.0.0.1", @@ -72,11 +37,6 @@ "data": "087.10.0.1", "valid": false }, - { - "description": "value without leading zero is valid", - "data": "87.10.0.1", - "valid": true - }, { "description": "invalid non-ASCII '২' (a Bengali 2)", "data": "1২7.0.0.1", diff --git a/tests/draft-next/optional/format/ipv6.json b/tests/draft-next/may/format-configured-assertion/ipv6.json similarity index 60% rename from tests/draft-next/optional/format/ipv6.json rename to tests/draft-next/may/format-configured-assertion/ipv6.json index 241df7f3..1e9e8f28 100644 --- a/tests/draft-next/optional/format/ipv6.json +++ b/tests/draft-next/may/format-configured-assertion/ipv6.json @@ -6,51 +6,11 @@ "format": "ipv6" }, "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 IPv6 address", - "data": "::1", - "valid": true - }, { "description": "an IPv6 address with out-of-range values", "data": "12345::", "valid": false }, - { - "description": "trailing 4 hex symbols is valid", - "data": "::abef", - "valid": true - }, { "description": "trailing 5 hex symbols is invalid", "data": "::abcef", @@ -66,21 +26,6 @@ "data": "::laptop", "valid": false }, - { - "description": "no digits is valid", - "data": "::", - "valid": true - }, - { - "description": "leading colons is valid", - "data": "::42:ff:1", - "valid": true - }, - { - "description": "trailing colons is valid", - "data": "d6::", - "valid": true - }, { "description": "missing leading octet is invalid", "data": ":2:3:4:5:6:7:8", @@ -96,26 +41,11 @@ "data": ":2:3:4::8", "valid": false }, - { - "description": "single set of double colons in the middle is valid", - "data": "1:d6::42", - "valid": true - }, { "description": "two sets of double colons is invalid", "data": "1::d6::42", "valid": false }, - { - "description": "mixed format with the ipv4 section as decimal octets", - "data": "1::d6:192.168.0.1", - "valid": true - }, - { - "description": "mixed format with double colons between the sections", - "data": "1:2::192.168.0.1", - "valid": true - }, { "description": "mixed format with ipv4 section with octet out of range", "data": "1::2:192.168.256.1", @@ -126,21 +56,11 @@ "data": "1::2:192.168.ff.1", "valid": false }, - { - "description": "mixed format with leading double colons (ipv4-mapped ipv6 address)", - "data": "::ffff:192.168.0.1", - "valid": true - }, { "description": "triple colons is invalid", "data": "1:2:3:4:5:::8", "valid": false }, - { - "description": "8 octets", - "data": "1:2:3:4:5:6:7:8", - "valid": true - }, { "description": "insufficient octets without double colons", "data": "1:2:3:4:5:6:7", @@ -181,11 +101,6 @@ "data": "fe80::a%eth1", "valid": false }, - { - "description": "a long valid ipv6", - "data": "1000:1000:1000:1000:1000:1000:255.255.255.255", - "valid": true - }, { "description": "a long invalid ipv6, below length limit, first", "data": "100:100:100:100:100:100:255.255.255.255.255", diff --git a/tests/draft-next/may/format-configured-assertion/iri-reference.json b/tests/draft-next/may/format-configured-assertion/iri-reference.json new file mode 100644 index 00000000..01c0cb74 --- /dev/null +++ b/tests/draft-next/may/format-configured-assertion/iri-reference.json @@ -0,0 +1,21 @@ +[ + { + "description": "validation of IRI References", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "iri-reference" + }, + "tests": [ + { + "description": "an invalid IRI Reference", + "data": "\\\\WINDOWS\\filëßåré", + "valid": false + }, + { + "description": "an invalid IRI fragment", + "data": "#ƒräg\\mênt", + "valid": false + } + ] + } +] diff --git a/tests/draft-next/may/format-configured-assertion/iri.json b/tests/draft-next/may/format-configured-assertion/iri.json new file mode 100644 index 00000000..8bd34c20 --- /dev/null +++ b/tests/draft-next/may/format-configured-assertion/iri.json @@ -0,0 +1,31 @@ +[ + { + "description": "validation of IRIs", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "iri" + }, + "tests": [ + { + "description": "an invalid IRI based on IPv6", + "data": "http://2001:0db8:85a3:0000:0000:8a2e:0370:7334", + "valid": false + }, + { + "description": "an invalid relative IRI Reference", + "data": "/abc", + "valid": false + }, + { + "description": "an invalid IRI", + "data": "\\\\WINDOWS\\filëßåré", + "valid": false + }, + { + "description": "an invalid IRI though valid IRI reference", + "data": "âππ", + "valid": false + } + ] + } +] diff --git a/tests/draft-next/may/format-configured-assertion/json-pointer.json b/tests/draft-next/may/format-configured-assertion/json-pointer.json new file mode 100644 index 00000000..379f47f5 --- /dev/null +++ b/tests/draft-next/may/format-configured-assertion/json-pointer.json @@ -0,0 +1,71 @@ +[ + { + "description": "validation of JSON-pointers (JSON String Representation)", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "json-pointer" + }, + "tests": [ + { + "description": "not a valid JSON-pointer (~ not escaped)", + "data": "/foo/bar~", + "valid": false + }, + { + "description": "not a valid JSON-pointer (URI Fragment Identifier) #1", + "data": "#", + "valid": false + }, + { + "description": "not a valid JSON-pointer (URI Fragment Identifier) #2", + "data": "#/", + "valid": false + }, + { + "description": "not a valid JSON-pointer (URI Fragment Identifier) #3", + "data": "#a", + "valid": false + }, + { + "description": "not a valid JSON-pointer (some escaped, but not all) #1", + "data": "/~0~", + "valid": false + }, + { + "description": "not a valid JSON-pointer (some escaped, but not all) #2", + "data": "/~0/~", + "valid": false + }, + { + "description": "not a valid JSON-pointer (wrong escape character) #1", + "data": "/~2", + "valid": false + }, + { + "description": "not a valid JSON-pointer (wrong escape character) #2", + "data": "/~-1", + "valid": false + }, + { + "description": "not a valid JSON-pointer (multiple characters not escaped)", + "data": "/~~", + "valid": false + }, + { + "description": "not a valid JSON-pointer (isn't empty nor starts with /) #1", + "data": "a", + "valid": false + }, + { + "description": "not a valid JSON-pointer (isn't empty nor starts with /) #2", + "data": "0", + "valid": false + }, + { + "description": "not a valid JSON-pointer (isn't empty nor starts with /) #3", + "data": "a/a", + "valid": false + } + ] + } +] diff --git a/tests/draft-next/may/format-configured-assertion/regex.json b/tests/draft-next/may/format-configured-assertion/regex.json new file mode 100644 index 00000000..9b9896be --- /dev/null +++ b/tests/draft-next/may/format-configured-assertion/regex.json @@ -0,0 +1,16 @@ +[ + { + "description": "validation of regular expressions", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "regex" + }, + "tests": [ + { + "description": "a regular expression with unclosed parens is invalid", + "data": "^(abc]", + "valid": false + } + ] + } +] diff --git a/tests/draft-next/may/format-configured-assertion/relative-json-pointer.json b/tests/draft-next/may/format-configured-assertion/relative-json-pointer.json new file mode 100644 index 00000000..fd347403 --- /dev/null +++ b/tests/draft-next/may/format-configured-assertion/relative-json-pointer.json @@ -0,0 +1,46 @@ +[ + { + "description": "validation of Relative JSON Pointers (RJP)", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "relative-json-pointer" + }, + "tests": [ + { + "description": "an invalid RJP that is a valid JSON Pointer", + "data": "/foo/bar", + "valid": false + }, + { + "description": "negative prefix", + "data": "-1/foo/bar", + "valid": false + }, + { + "description": "explicit positive prefix", + "data": "+1/foo/bar", + "valid": false + }, + { + "description": "## is not a valid json-pointer", + "data": "0##", + "valid": false + }, + { + "description": "zero cannot be followed by other digits, plus json-pointer", + "data": "01/a", + "valid": false + }, + { + "description": "zero cannot be followed by other digits, plus octothorpe", + "data": "01#", + "valid": false + }, + { + "description": "empty string", + "data": "", + "valid": false + } + ] + } +] diff --git a/tests/draft-next/optional/format/time.json b/tests/draft-next/may/format-configured-assertion/time.json similarity index 62% rename from tests/draft-next/optional/format/time.json rename to tests/draft-next/may/format-configured-assertion/time.json index 0a000a48..8d358b05 100644 --- a/tests/draft-next/optional/format/time.json +++ b/tests/draft-next/may/format-configured-assertion/time.json @@ -6,41 +6,6 @@ "format": "time" }, "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 time string", - "data": "08:30:06Z", - "valid": true - }, { "description": "invalid time string with extra leading zeros", "data": "008:030:006Z", @@ -56,11 +21,6 @@ "data": "8:0030:6Z", "valid": false }, - { - "description": "a valid time string with leap second, Zulu", - "data": "23:59:60Z", - "valid": true - }, { "description": "invalid leap second, Zulu (wrong hour)", "data": "22:59:60Z", @@ -71,11 +31,6 @@ "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", @@ -86,16 +41,6 @@ "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", @@ -106,16 +51,6 @@ "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", @@ -126,36 +61,11 @@ "data": "23:59:60-00:30", "valid": false }, - { - "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": "hour, minute in time-offset must be two digits", "data": "08:30:06-8:000", "valid": false }, - { - "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", diff --git a/tests/draft-next/may/format-configured-assertion/uri-reference.json b/tests/draft-next/may/format-configured-assertion/uri-reference.json new file mode 100644 index 00000000..6c42142f --- /dev/null +++ b/tests/draft-next/may/format-configured-assertion/uri-reference.json @@ -0,0 +1,21 @@ +[ + { + "description": "validation of URI References", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "uri-reference" + }, + "tests": [ + { + "description": "an invalid URI Reference", + "data": "\\\\WINDOWS\\fileshare", + "valid": false + }, + { + "description": "an invalid URI fragment", + "data": "#frag\\ment", + "valid": false + } + ] + } +] diff --git a/tests/draft-next/may/format-configured-assertion/uri-template.json b/tests/draft-next/may/format-configured-assertion/uri-template.json new file mode 100644 index 00000000..84e29187 --- /dev/null +++ b/tests/draft-next/may/format-configured-assertion/uri-template.json @@ -0,0 +1,16 @@ +[ + { + "description": "format: uri-template", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "uri-template" + }, + "tests": [ + { + "description": "an invalid uri-template", + "data": "http://example.com/dictionary/{term:1}/{term", + "valid": false + } + ] + } +] diff --git a/tests/draft-next/may/format-configured-assertion/uri.json b/tests/draft-next/may/format-configured-assertion/uri.json new file mode 100644 index 00000000..9042481c --- /dev/null +++ b/tests/draft-next/may/format-configured-assertion/uri.json @@ -0,0 +1,46 @@ +[ + { + "description": "validation of URIs", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "uri" + }, + "tests": [ + { + "description": "an invalid protocol-relative URI Reference", + "data": "//foo.bar/?baz=qux#quux", + "valid": false + }, + { + "description": "an invalid relative URI Reference", + "data": "/abc", + "valid": false + }, + { + "description": "an invalid URI", + "data": "\\\\WINDOWS\\fileshare", + "valid": false + }, + { + "description": "an invalid URI though valid URI reference", + "data": "abc", + "valid": false + }, + { + "description": "an invalid URI with spaces", + "data": "http:// shouldfail.com", + "valid": false + }, + { + "description": "an invalid URI with spaces and missing scheme", + "data": ":// should fail", + "valid": false + }, + { + "description": "an invalid URI with comma in scheme", + "data": "bar,baz:foo", + "valid": false + } + ] + } +] diff --git a/tests/draft-next/may/format-configured-assertion/uuid.json b/tests/draft-next/may/format-configured-assertion/uuid.json new file mode 100644 index 00000000..1d3e3953 --- /dev/null +++ b/tests/draft-next/may/format-configured-assertion/uuid.json @@ -0,0 +1,46 @@ +[ + { + "description": "uuid format", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "uuid" + }, + "tests": [ + { + "description": "wrong length", + "data": "2eb8aa08-aa98-11ea-b4aa-73b441d1638", + "valid": false + }, + { + "description": "missing section", + "data": "2eb8aa08-aa98-11ea-73b441d16380", + "valid": false + }, + { + "description": "bad characters (not hex)", + "data": "2eb8aa08-aa98-11ea-b4ga-73b441d16380", + "valid": false + }, + { + "description": "no dashes", + "data": "2eb8aa08aa9811eab4aa73b441d16380", + "valid": false + }, + { + "description": "too few dashes", + "data": "2eb8aa08aa98-11ea-b4aa73b441d16380", + "valid": false + }, + { + "description": "too many dashes", + "data": "2eb8-aa08-aa98-11ea-b4aa73b44-1d16380", + "valid": false + }, + { + "description": "dashes in the wrong spot", + "data": "2eb8aa08aa9811eab4aa73b441d16380----", + "valid": false + } + ] + } +] diff --git a/tests/draft-next/should/format-configured-assertion/README.md b/tests/draft-next/should/format-configured-assertion/README.md new file mode 100644 index 00000000..96fba115 --- /dev/null +++ b/tests/draft-next/should/format-configured-assertion/README.md @@ -0,0 +1,15 @@ +This folder contains tests to cover the case when the `format-annotation` vocabulary is present, meaning `format` should not be validated, but the implementation is configured to validate it anyway. + +_Implementations must be configured to validate `format` when running these tests in order for the tests to be effective._ If the implementation does not support such a configuration, these tests may be skipped. + + +[Validation Section 7.2.1](https://json-schema.org/draft/2020-12/json-schema-validation#section-7.2.1) states + +> When the implementation is configured for assertion behavior, it: +> +> - SHOULD provide an implementation-specific best effort validation for each format attribute defined below; +> - MAY choose to implement validation of any or all format attributes as a no-op by always producing a validation result of true; + +The tests in herein cover the first point. As such, these test cases are valid data for their respective formats, so validation is expected to pass. + +An implementation which returns a failing validation for these scenarios is permissible, but discouraged. \ No newline at end of file diff --git a/tests/draft-next/optional/format/date-time.json b/tests/draft-next/should/format-configured-assertion/date-time.json similarity index 52% rename from tests/draft-next/optional/format/date-time.json rename to tests/draft-next/should/format-configured-assertion/date-time.json index e25845b0..716bed74 100644 --- a/tests/draft-next/optional/format/date-time.json +++ b/tests/draft-next/should/format-configured-assertion/date-time.json @@ -66,70 +66,10 @@ "data": "1998-12-31T15:59:60.123-08:00", "valid": true }, - { - "description": "an invalid date-time past leap second, UTC", - "data": "1998-12-31T23:59:61Z", - "valid": false - }, - { - "description": "an invalid date-time with leap second on a wrong minute, UTC", - "data": "1998-12-31T23:58:60Z", - "valid": false - }, - { - "description": "an invalid date-time with leap second on a wrong hour, UTC", - "data": "1998-12-31T22:59:60Z", - "valid": false - }, - { - "description": "an invalid day in date-time string", - "data": "1990-02-31T15:59:59.123-08:00", - "valid": false - }, - { - "description": "an invalid offset in date-time string", - "data": "1990-12-31T15:59:59-24:00", - "valid": false - }, - { - "description": "an invalid closing Z after time-zone offset", - "data": "1963-06-19T08:30:06.28123+01:00Z", - "valid": false - }, - { - "description": "an invalid date-time string", - "data": "06/19/1963 08:30:06 PST", - "valid": false - }, { "description": "case-insensitive T and Z", "data": "1963-06-19t08:30:06.283185z", "valid": true - }, - { - "description": "only RFC3339 not all of ISO 8601 are valid", - "data": "2013-350T01:01:01", - "valid": false - }, - { - "description": "invalid non-padded month dates", - "data": "1963-6-19T08:30:06.283185Z", - "valid": false - }, - { - "description": "invalid non-padded day dates", - "data": "1963-06-1T08:30:06.283185Z", - "valid": false - }, - { - "description": "invalid non-ASCII '৪' (a Bengali 4) in date portion", - "data": "1963-06-1৪T00:00:00Z", - "valid": false - }, - { - "description": "invalid non-ASCII '৪' (a Bengali 4) in time portion", - "data": "1963-06-11T0৪:00:00Z", - "valid": false } ] } diff --git a/tests/draft-next/should/format-configured-assertion/date.json b/tests/draft-next/should/format-configured-assertion/date.json new file mode 100644 index 00000000..16ffd892 --- /dev/null +++ b/tests/draft-next/should/format-configured-assertion/date.json @@ -0,0 +1,116 @@ +[ + { + "description": "validation of date strings", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "date" + }, + "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 date string", + "data": "1963-06-19", + "valid": true + }, + { + "description": "a valid date string with 31 days in January", + "data": "2020-01-31", + "valid": true + }, + { + "description": "a valid date string with 28 days in February (normal)", + "data": "2021-02-28", + "valid": true + }, + { + "description": "a valid date string with 29 days in February (leap)", + "data": "2020-02-29", + "valid": true + }, + { + "description": "a valid date string with 31 days in March", + "data": "2020-03-31", + "valid": true + }, + { + "description": "a valid date string with 30 days in April", + "data": "2020-04-30", + "valid": true + }, + { + "description": "a valid date string with 31 days in May", + "data": "2020-05-31", + "valid": true + }, + { + "description": "a valid date string with 30 days in June", + "data": "2020-06-30", + "valid": true + }, + { + "description": "a valid date string with 31 days in July", + "data": "2020-07-31", + "valid": true + }, + { + "description": "a valid date string with 31 days in August", + "data": "2020-08-31", + "valid": true + }, + { + "description": "a valid date string with 30 days in September", + "data": "2020-09-30", + "valid": true + }, + { + "description": "a valid date string with 31 days in October", + "data": "2020-10-31", + "valid": true + }, + { + "description": "a valid date string with 30 days in November", + "data": "2020-11-30", + "valid": true + }, + { + "description": "a valid date string with 31 days in December", + "data": "2020-12-31", + "valid": true + }, + { + "description": "2020 is a leap year", + "data": "2020-02-29", + "valid": true + } + ] + } +] diff --git a/tests/draft-next/optional/format/duration.json b/tests/draft-next/should/format-configured-assertion/duration.json similarity index 61% rename from tests/draft-next/optional/format/duration.json rename to tests/draft-next/should/format-configured-assertion/duration.json index d5adca20..80608bc6 100644 --- a/tests/draft-next/optional/format/duration.json +++ b/tests/draft-next/should/format-configured-assertion/duration.json @@ -41,41 +41,6 @@ "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", @@ -115,21 +80,6 @@ "description": "two weeks", "data": "P2W", "valid": true - }, - { - "description": "weeks cannot be combined with other units", - "data": "P1Y2W", - "valid": false - }, - { - "description": "invalid non-ASCII '২' (a Bengali 2)", - "data": "P২Y", - "valid": false - }, - { - "description": "element without unit", - "data": "P1", - "valid": false } ] } diff --git a/tests/draft-next/optional/format/email.json b/tests/draft-next/should/format-configured-assertion/email.json similarity index 74% rename from tests/draft-next/optional/format/email.json rename to tests/draft-next/should/format-configured-assertion/email.json index 5948ebd1..5f511ff8 100644 --- a/tests/draft-next/optional/format/email.json +++ b/tests/draft-next/should/format-configured-assertion/email.json @@ -41,11 +41,6 @@ "data": "joe.bloggs@example.com", "valid": true }, - { - "description": "an invalid e-mail address", - "data": "2962", - "valid": false - }, { "description": "tilde in local part is valid", "data": "te~st@example.com", @@ -86,35 +81,10 @@ "data": "joe.bloggs@[IPv6:::1]", "valid": true }, - { - "description": "dot before local part is not valid", - "data": ".test@example.com", - "valid": false - }, - { - "description": "dot after local part is not valid", - "data": "test.@example.com", - "valid": false - }, { "description": "two separated dots inside local part are valid", "data": "te.s.t@example.com", "valid": true - }, - { - "description": "two subsequent dots inside local part are not valid", - "data": "te..st@example.com", - "valid": false - }, - { - "description": "an invalid domain", - "data": "joe.bloggs@invalid=domain.com", - "valid": false - }, - { - "description": "an invalid IPv4-address-literal", - "data": "joe.bloggs@[127.0.0.300]", - "valid": false } ] } diff --git a/tests/draft-next/optional/format/hostname.json b/tests/draft-next/should/format-configured-assertion/hostname.json similarity index 60% rename from tests/draft-next/optional/format/hostname.json rename to tests/draft-next/should/format-configured-assertion/hostname.json index bfb30636..d970c7f5 100644 --- a/tests/draft-next/optional/format/hostname.json +++ b/tests/draft-next/should/format-configured-assertion/hostname.json @@ -46,56 +46,11 @@ "data": "xn--4gbwdl.xn--wgbh1c", "valid": true }, - { - "description": "a host name starting with an illegal character", - "data": "-a-host-name-that-starts-with--", - "valid": false - }, - { - "description": "a host name containing illegal characters", - "data": "not_a_valid_host_name", - "valid": false - }, - { - "description": "a host name with a component too long", - "data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component", - "valid": false - }, - { - "description": "starts with hyphen", - "data": "-hostname", - "valid": false - }, - { - "description": "ends with hyphen", - "data": "hostname-", - "valid": false - }, - { - "description": "starts with underscore", - "data": "_hostname", - "valid": false - }, - { - "description": "ends with underscore", - "data": "hostname_", - "valid": false - }, - { - "description": "contains underscore", - "data": "host_name", - "valid": false - }, { "description": "maximum label length", "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com", "valid": true }, - { - "description": "exceeds maximum label length", - "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com", - "valid": false - }, { "description": "single label", "data": "hostname", diff --git a/tests/draft-next/optional/format/idn-email.json b/tests/draft-next/should/format-configured-assertion/idn-email.json similarity index 83% rename from tests/draft-next/optional/format/idn-email.json rename to tests/draft-next/should/format-configured-assertion/idn-email.json index 1f353670..0c31eb50 100644 --- a/tests/draft-next/optional/format/idn-email.json +++ b/tests/draft-next/should/format-configured-assertion/idn-email.json @@ -41,20 +41,10 @@ "data": "실례@실례.테스트", "valid": true }, - { - "description": "an invalid idn e-mail address", - "data": "2962", - "valid": false - }, { "description": "a valid e-mail address", "data": "joe.bloggs@example.com", "valid": true - }, - { - "description": "an invalid e-mail address", - "data": "2962", - "valid": false } ] } diff --git a/tests/draft-next/should/format-configured-assertion/idn-hostname.json b/tests/draft-next/should/format-configured-assertion/idn-hostname.json new file mode 100644 index 00000000..3e9bc735 --- /dev/null +++ b/tests/draft-next/should/format-configured-assertion/idn-hostname.json @@ -0,0 +1,161 @@ +[ + { + "description": "validation of internationalized host names", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "idn-hostname" + }, + "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 host name (example.test in Hangul)", + "data": "실례.테스트", + "valid": true + }, + { + "description": "valid Chinese Punycode", + "comment": "https://tools.ietf.org/html/rfc5890#section-2.3.2.1 https://tools.ietf.org/html/rfc5891#section-4.4", + "data": "xn--ihqwcrb4cv8a8dqg056pqjye", + "valid": true + }, + { + "description": "Exceptions that are PVALID, left-to-right chars", + "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6", + "data": "\u00df\u03c2\u0f0b\u3007", + "valid": true + }, + { + "description": "Exceptions that are PVALID, right-to-left chars", + "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6", + "data": "\u06fd\u06fe", + "valid": true + }, + { + "description": "MIDDLE DOT with surrounding 'l's", + "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3", + "data": "l\u00b7l", + "valid": true + }, + { + "description": "Greek KERAIA followed by Greek", + "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.4", + "data": "\u03b1\u0375\u03b2", + "valid": true + }, + { + "description": "Hebrew GERESH preceded by Hebrew", + "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.5", + "data": "\u05d0\u05f3\u05d1", + "valid": true + }, + { + "description": "Hebrew GERSHAYIM preceded by Hebrew", + "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.6", + "data": "\u05d0\u05f4\u05d1", + "valid": true + }, + { + "description": "KATAKANA MIDDLE DOT with Hiragana", + "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7", + "data": "\u30fb\u3041", + "valid": true + }, + { + "description": "KATAKANA MIDDLE DOT with Katakana", + "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7", + "data": "\u30fb\u30a1", + "valid": true + }, + { + "description": "KATAKANA MIDDLE DOT with Han", + "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7", + "data": "\u30fb\u4e08", + "valid": true + }, + { + "description": "Arabic-Indic digits not mixed with Extended Arabic-Indic digits", + "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.8", + "data": "\u0628\u0660\u0628", + "valid": true + }, + { + "description": "Extended Arabic-Indic digits not mixed with Arabic-Indic digits", + "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.9", + "data": "\u06f00", + "valid": true + }, + { + "description": "ZERO WIDTH JOINER preceded by Virama", + "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.2 https://www.unicode.org/review/pr-37.pdf", + "data": "\u0915\u094d\u200d\u0937", + "valid": true + }, + { + "description": "ZERO WIDTH NON-JOINER preceded by Virama", + "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1", + "data": "\u0915\u094d\u200c\u0937", + "valid": true + }, + { + "description": "ZERO WIDTH NON-JOINER not preceded by Virama but matches regexp", + "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1 https://www.w3.org/TR/alreq/#h_disjoining_enforcement", + "data": "\u0628\u064a\u200c\u0628\u064a", + "valid": true + }, + { + "description": "single label", + "data": "hostname", + "valid": true + }, + { + "description": "single label with hyphen", + "data": "host-name", + "valid": true + }, + { + "description": "single label with digits", + "data": "h0stn4me", + "valid": true + }, + { + "description": "single label starting with digit", + "data": "1host", + "valid": true + }, + { + "description": "single label ending with digit", + "data": "hostnam3", + "valid": true + } + ] + } +] diff --git a/tests/draft-next/should/format-configured-assertion/ipv4.json b/tests/draft-next/should/format-configured-assertion/ipv4.json new file mode 100644 index 00000000..eab1a71a --- /dev/null +++ b/tests/draft-next/should/format-configured-assertion/ipv4.json @@ -0,0 +1,51 @@ +[ + { + "description": "validation of IP addresses", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "ipv4" + }, + "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 IP address", + "data": "192.168.0.1", + "valid": true + }, + { + "description": "value without leading zero is valid", + "data": "87.10.0.1", + "valid": true + } + ] + } +] diff --git a/tests/draft-next/should/format-configured-assertion/ipv6.json b/tests/draft-next/should/format-configured-assertion/ipv6.json new file mode 100644 index 00000000..07796a01 --- /dev/null +++ b/tests/draft-next/should/format-configured-assertion/ipv6.json @@ -0,0 +1,96 @@ +[ + { + "description": "validation of IPv6 addresses", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "ipv6" + }, + "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 IPv6 address", + "data": "::1", + "valid": true + }, + { + "description": "trailing 4 hex symbols is valid", + "data": "::abef", + "valid": true + }, + { + "description": "no digits is valid", + "data": "::", + "valid": true + }, + { + "description": "leading colons is valid", + "data": "::42:ff:1", + "valid": true + }, + { + "description": "trailing colons is valid", + "data": "d6::", + "valid": true + }, + { + "description": "single set of double colons in the middle is valid", + "data": "1:d6::42", + "valid": true + }, + { + "description": "mixed format with the ipv4 section as decimal octets", + "data": "1::d6:192.168.0.1", + "valid": true + }, + { + "description": "mixed format with double colons between the sections", + "data": "1:2::192.168.0.1", + "valid": true + }, + { + "description": "mixed format with leading double colons (ipv4-mapped ipv6 address)", + "data": "::ffff:192.168.0.1", + "valid": true + }, + { + "description": "8 octets", + "data": "1:2:3:4:5:6:7:8", + "valid": true + }, + { + "description": "a long valid ipv6", + "data": "1000:1000:1000:1000:1000:1000:255.255.255.255", + "valid": true + } + ] + } +] diff --git a/tests/draft-next/optional/format/iri-reference.json b/tests/draft-next/should/format-configured-assertion/iri-reference.json similarity index 85% rename from tests/draft-next/optional/format/iri-reference.json rename to tests/draft-next/should/format-configured-assertion/iri-reference.json index 543b99e7..3addadab 100644 --- a/tests/draft-next/optional/format/iri-reference.json +++ b/tests/draft-next/should/format-configured-assertion/iri-reference.json @@ -51,11 +51,6 @@ "data": "/âππ", "valid": true }, - { - "description": "an invalid IRI Reference", - "data": "\\\\WINDOWS\\filëßåré", - "valid": false - }, { "description": "a valid IRI Reference", "data": "âππ", @@ -65,11 +60,6 @@ "description": "a valid IRI fragment", "data": "#ƒrägmênt", "valid": true - }, - { - "description": "an invalid IRI fragment", - "data": "#ƒräg\\mênt", - "valid": false } ] } diff --git a/tests/draft-next/optional/format/iri.json b/tests/draft-next/should/format-configured-assertion/iri.json similarity index 75% rename from tests/draft-next/optional/format/iri.json rename to tests/draft-next/should/format-configured-assertion/iri.json index 48e82a28..89ff48cd 100644 --- a/tests/draft-next/optional/format/iri.json +++ b/tests/draft-next/should/format-configured-assertion/iri.json @@ -60,26 +60,6 @@ "description": "a valid IRI based on IPv6", "data": "http://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]", "valid": true - }, - { - "description": "an invalid IRI based on IPv6", - "data": "http://2001:0db8:85a3:0000:0000:8a2e:0370:7334", - "valid": false - }, - { - "description": "an invalid relative IRI Reference", - "data": "/abc", - "valid": false - }, - { - "description": "an invalid IRI", - "data": "\\\\WINDOWS\\filëßåré", - "valid": false - }, - { - "description": "an invalid IRI though valid IRI reference", - "data": "âππ", - "valid": false } ] } diff --git a/tests/draft-next/optional/format/json-pointer.json b/tests/draft-next/should/format-configured-assertion/json-pointer.json similarity index 70% rename from tests/draft-next/optional/format/json-pointer.json rename to tests/draft-next/should/format-configured-assertion/json-pointer.json index f55342f1..83fc58bc 100644 --- a/tests/draft-next/optional/format/json-pointer.json +++ b/tests/draft-next/should/format-configured-assertion/json-pointer.json @@ -140,61 +140,6 @@ "description": "valid JSON-pointer (escaped with fraction part) #2", "data": "/~0.1", "valid": true - }, - { - "description": "not a valid JSON-pointer (URI Fragment Identifier) #1", - "data": "#", - "valid": false - }, - { - "description": "not a valid JSON-pointer (URI Fragment Identifier) #2", - "data": "#/", - "valid": false - }, - { - "description": "not a valid JSON-pointer (URI Fragment Identifier) #3", - "data": "#a", - "valid": false - }, - { - "description": "not a valid JSON-pointer (some escaped, but not all) #1", - "data": "/~0~", - "valid": false - }, - { - "description": "not a valid JSON-pointer (some escaped, but not all) #2", - "data": "/~0/~", - "valid": false - }, - { - "description": "not a valid JSON-pointer (wrong escape character) #1", - "data": "/~2", - "valid": false - }, - { - "description": "not a valid JSON-pointer (wrong escape character) #2", - "data": "/~-1", - "valid": false - }, - { - "description": "not a valid JSON-pointer (multiple characters not escaped)", - "data": "/~~", - "valid": false - }, - { - "description": "not a valid JSON-pointer (isn't empty nor starts with /) #1", - "data": "a", - "valid": false - }, - { - "description": "not a valid JSON-pointer (isn't empty nor starts with /) #2", - "data": "0", - "valid": false - }, - { - "description": "not a valid JSON-pointer (isn't empty nor starts with /) #3", - "data": "a/a", - "valid": false } ] } diff --git a/tests/draft-next/optional/format/regex.json b/tests/draft-next/should/format-configured-assertion/regex.json similarity index 88% rename from tests/draft-next/optional/format/regex.json rename to tests/draft-next/should/format-configured-assertion/regex.json index 5987f534..a310fd36 100644 --- a/tests/draft-next/optional/format/regex.json +++ b/tests/draft-next/should/format-configured-assertion/regex.json @@ -40,11 +40,6 @@ "description": "a valid regular expression", "data": "([abc])+\\s+$", "valid": true - }, - { - "description": "a regular expression with unclosed parens is invalid", - "data": "^(abc]", - "valid": false } ] } diff --git a/tests/draft-next/optional/format/relative-json-pointer.json b/tests/draft-next/should/format-configured-assertion/relative-json-pointer.json similarity index 63% rename from tests/draft-next/optional/format/relative-json-pointer.json rename to tests/draft-next/should/format-configured-assertion/relative-json-pointer.json index 1e28fc29..d75a4b51 100644 --- a/tests/draft-next/optional/format/relative-json-pointer.json +++ b/tests/draft-next/should/format-configured-assertion/relative-json-pointer.json @@ -56,41 +56,6 @@ "data": "0#", "valid": true }, - { - "description": "an invalid RJP that is a valid JSON Pointer", - "data": "/foo/bar", - "valid": false - }, - { - "description": "negative prefix", - "data": "-1/foo/bar", - "valid": false - }, - { - "description": "explicit positive prefix", - "data": "+1/foo/bar", - "valid": false - }, - { - "description": "## is not a valid json-pointer", - "data": "0##", - "valid": false - }, - { - "description": "zero cannot be followed by other digits, plus json-pointer", - "data": "01/a", - "valid": false - }, - { - "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", diff --git a/tests/draft-next/should/format-configured-assertion/time.json b/tests/draft-next/should/format-configured-assertion/time.json new file mode 100644 index 00000000..43e988ee --- /dev/null +++ b/tests/draft-next/should/format-configured-assertion/time.json @@ -0,0 +1,101 @@ +[ + { + "description": "validation of time strings", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "format": "time" + }, + "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 time string", + "data": "08:30:06Z", + "valid": true + }, + { + "description": "a valid time string with leap second, Zulu", + "data": "23:59:60Z", + "valid": true + }, + { + "description": "valid leap second, zero time-offset", + "data": "23:59:60+00:00", + "valid": true + }, + { + "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": "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": "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 + } + ] + } +] diff --git a/tests/draft-next/optional/format/uri-reference.json b/tests/draft-next/should/format-configured-assertion/uri-reference.json similarity index 85% rename from tests/draft-next/optional/format/uri-reference.json rename to tests/draft-next/should/format-configured-assertion/uri-reference.json index 8d9d254e..acfad5ad 100644 --- a/tests/draft-next/optional/format/uri-reference.json +++ b/tests/draft-next/should/format-configured-assertion/uri-reference.json @@ -51,11 +51,6 @@ "data": "/abc", "valid": true }, - { - "description": "an invalid URI Reference", - "data": "\\\\WINDOWS\\fileshare", - "valid": false - }, { "description": "a valid URI Reference", "data": "abc", @@ -65,11 +60,6 @@ "description": "a valid URI fragment", "data": "#fragment", "valid": true - }, - { - "description": "an invalid URI fragment", - "data": "#frag\\ment", - "valid": false } ] } diff --git a/tests/draft-next/optional/format/uri-template.json b/tests/draft-next/should/format-configured-assertion/uri-template.json similarity index 90% rename from tests/draft-next/optional/format/uri-template.json rename to tests/draft-next/should/format-configured-assertion/uri-template.json index f57d62df..ea12f107 100644 --- a/tests/draft-next/optional/format/uri-template.json +++ b/tests/draft-next/should/format-configured-assertion/uri-template.json @@ -41,11 +41,6 @@ "data": "http://example.com/dictionary/{term:1}/{term}", "valid": true }, - { - "description": "an invalid uri-template", - "data": "http://example.com/dictionary/{term:1}/{term", - "valid": false - }, { "description": "a valid uri-template without variables", "data": "http://example.com/dictionary", diff --git a/tests/draft-next/optional/format/uri.json b/tests/draft-next/should/format-configured-assertion/uri.json similarity index 74% rename from tests/draft-next/optional/format/uri.json rename to tests/draft-next/should/format-configured-assertion/uri.json index 50908eab..47655694 100644 --- a/tests/draft-next/optional/format/uri.json +++ b/tests/draft-next/should/format-configured-assertion/uri.json @@ -100,41 +100,6 @@ "description": "a valid URN", "data": "urn:oasis:names:specification:docbook:dtd:xml:4.1.2", "valid": true - }, - { - "description": "an invalid protocol-relative URI Reference", - "data": "//foo.bar/?baz=qux#quux", - "valid": false - }, - { - "description": "an invalid relative URI Reference", - "data": "/abc", - "valid": false - }, - { - "description": "an invalid URI", - "data": "\\\\WINDOWS\\fileshare", - "valid": false - }, - { - "description": "an invalid URI though valid URI reference", - "data": "abc", - "valid": false - }, - { - "description": "an invalid URI with spaces", - "data": "http:// shouldfail.com", - "valid": false - }, - { - "description": "an invalid URI with spaces and missing scheme", - "data": ":// should fail", - "valid": false - }, - { - "description": "an invalid URI with comma in scheme", - "data": "bar,baz:foo", - "valid": false } ] } diff --git a/tests/draft-next/optional/format/uuid.json b/tests/draft-next/should/format-configured-assertion/uuid.json similarity index 67% rename from tests/draft-next/optional/format/uuid.json rename to tests/draft-next/should/format-configured-assertion/uuid.json index 6cea9dad..6705af99 100644 --- a/tests/draft-next/optional/format/uuid.json +++ b/tests/draft-next/should/format-configured-assertion/uuid.json @@ -56,41 +56,6 @@ "data": "00000000-0000-0000-0000-000000000000", "valid": true }, - { - "description": "wrong length", - "data": "2eb8aa08-aa98-11ea-b4aa-73b441d1638", - "valid": false - }, - { - "description": "missing section", - "data": "2eb8aa08-aa98-11ea-73b441d16380", - "valid": false - }, - { - "description": "bad characters (not hex)", - "data": "2eb8aa08-aa98-11ea-b4ga-73b441d16380", - "valid": false - }, - { - "description": "no dashes", - "data": "2eb8aa08aa9811eab4aa73b441d16380", - "valid": false - }, - { - "description": "too few dashes", - "data": "2eb8aa08aa98-11ea-b4aa73b441d16380", - "valid": false - }, - { - "description": "too many dashes", - "data": "2eb8-aa08-aa98-11ea-b4aa73b44-1d16380", - "valid": false - }, - { - "description": "dashes in the wrong spot", - "data": "2eb8aa08aa9811eab4aa73b441d16380----", - "valid": false - }, { "description": "valid version 4", "data": "98d80576-482e-427f-8434-7f86890ab222", From 008726c8bc0e3d74c4cce6d93f6cd34dfe6db4a1 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Thu, 23 Nov 2023 10:27:58 +1300 Subject: [PATCH 2/3] sort remaining tests --- .../may/format-configured-assertion/README.md | 2 +- tests/draft-next/optional/questions.md | 30 +++++++++++++++++++ tests/draft-next/should/README.md | 3 ++ .../ecmascript-regex.json | 0 .../format-configured-assertion/README.md | 2 +- tests/draft-next/undefined/README.md | 21 +++++++++++++ .../{optional => undefined}/bignum.json | 0 .../dependencies-compatibility.json | 0 .../float-overflow.json | 0 .../non-bmp-regex.json | 0 .../refOfUnknownKeyword.json | 0 11 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 tests/draft-next/optional/questions.md create mode 100644 tests/draft-next/should/README.md rename tests/draft-next/{optional => should}/ecmascript-regex.json (100%) create mode 100644 tests/draft-next/undefined/README.md rename tests/draft-next/{optional => undefined}/bignum.json (100%) rename tests/draft-next/{optional => undefined}/dependencies-compatibility.json (100%) rename tests/draft-next/{optional => undefined}/float-overflow.json (100%) rename tests/draft-next/{optional => undefined}/non-bmp-regex.json (100%) rename tests/draft-next/{optional => undefined}/refOfUnknownKeyword.json (100%) diff --git a/tests/draft-next/may/format-configured-assertion/README.md b/tests/draft-next/may/format-configured-assertion/README.md index bd1c9772..702dd341 100644 --- a/tests/draft-next/may/format-configured-assertion/README.md +++ b/tests/draft-next/may/format-configured-assertion/README.md @@ -12,4 +12,4 @@ _Implementations must be configured to validate `format` when running these test The tests in herein cover the second point. As such, these test cases are invalid data for their respective formats, so validation is expected to fail. -An implementation which returns a passing validation for these scenarios is permissible. \ No newline at end of file +Returns a passing validation for these scenarios is permitted. \ No newline at end of file diff --git a/tests/draft-next/optional/questions.md b/tests/draft-next/optional/questions.md new file mode 100644 index 00000000..c41aba51 --- /dev/null +++ b/tests/draft-next/optional/questions.md @@ -0,0 +1,30 @@ +### `bignum` & `float-overflow` + +Are these tests in optional because the JSON spec makes a concession for environments that can't handle arbitrary numbers? While JSON Schema doesn't define any restrictions, it also doesn't make any such concessions. + +I've put them in _undefined/_ for now. + +References: +- https://datatracker.ietf.org/doc/html/rfc8259#section-6 +- https://json-schema.org/draft/2020-12/json-schema-validation#section-4.2 + +### `format-assertion` + +The spec isn't explicit on the requirement level for vocabularies as a feature. I'd (@gregsdennis) assume it's a MUST, but that's just an interpretation. + +There are requirement levels on `$vocabulary` and its usage, but nothing requiring that vocabularies be a supported feature in general. + +As such, I'm not sure where this should go. + +First, all of these tests assume that the `format-assertion` vocabulary is understood, which is optional. ("An implementation that supports the Format-Assertion vocabulary..." implies that implementations have the option to not support it.) + +Secondly, assuming the above, these test become mandatory because "full validation support" is a MUST requirement. + +I think this is a MAY overall, but could use confirmation. + +Also, we don't have any tests around _not_ understanding the `format-assertion` vocabulary. I think this is partially due to the fact that we can't handle error scenarios. + +References: +- https://json-schema.org/draft/2020-12/json-schema-core#section-4.3.3 +- https://json-schema.org/draft/2020-12/json-schema-core#section-8.1.2 +- https://json-schema.org/draft/2020-12/json-schema-validation#section-7.2.2 \ No newline at end of file diff --git a/tests/draft-next/should/README.md b/tests/draft-next/should/README.md new file mode 100644 index 00000000..5e5d0703 --- /dev/null +++ b/tests/draft-next/should/README.md @@ -0,0 +1,3 @@ +This folder contains tests for features that are specified with a SHOULD, meaning they are highly encouraged, but implementations are permitted to behave differently if there is good reason to do so. ("Good reason" being subjective.) + +Failing these tests is permitted, but discouraged. \ No newline at end of file diff --git a/tests/draft-next/optional/ecmascript-regex.json b/tests/draft-next/should/ecmascript-regex.json similarity index 100% rename from tests/draft-next/optional/ecmascript-regex.json rename to tests/draft-next/should/ecmascript-regex.json diff --git a/tests/draft-next/should/format-configured-assertion/README.md b/tests/draft-next/should/format-configured-assertion/README.md index 96fba115..6c38b108 100644 --- a/tests/draft-next/should/format-configured-assertion/README.md +++ b/tests/draft-next/should/format-configured-assertion/README.md @@ -12,4 +12,4 @@ _Implementations must be configured to validate `format` when running these test The tests in herein cover the first point. As such, these test cases are valid data for their respective formats, so validation is expected to pass. -An implementation which returns a failing validation for these scenarios is permissible, but discouraged. \ No newline at end of file +Returning a failing validation for these scenarios is permitted, but discouraged. \ No newline at end of file diff --git a/tests/draft-next/undefined/README.md b/tests/draft-next/undefined/README.md new file mode 100644 index 00000000..dbc4601c --- /dev/null +++ b/tests/draft-next/undefined/README.md @@ -0,0 +1,21 @@ +These tests cover behaviors that: + +- the JSON Schema specification explicitly states is undefined +- the JSON Schema specification does not address at all +- have been found to have limited interoperability + +Largely, these tests come from implementation behaviors we've observed in the wild, and they serve as documentation that _someone_ decided to do it a particular way. These behaviors' inclusion in this suite does NOT imply endorsement by either the specification or the organization. + +As such, many of these tests may actually be contradictory, and it is not expected that any single implementation should (or even could) pass all of them. + +### `dependencies` compatibility + +The `dependencies` keyword has been deprecated as of draft 2019-09, however some implementations may wish to continue supporting it. + +These tests ensure that functionality remains consistent with the previous drafts which defined the keyword. + +### Referencing into unknown locations + +This behavior is explicitly undefined. + +See https://json-schema.org/draft/2020-12/json-schema-core#section-9.4.2. \ No newline at end of file diff --git a/tests/draft-next/optional/bignum.json b/tests/draft-next/undefined/bignum.json similarity index 100% rename from tests/draft-next/optional/bignum.json rename to tests/draft-next/undefined/bignum.json diff --git a/tests/draft-next/optional/dependencies-compatibility.json b/tests/draft-next/undefined/dependencies-compatibility.json similarity index 100% rename from tests/draft-next/optional/dependencies-compatibility.json rename to tests/draft-next/undefined/dependencies-compatibility.json diff --git a/tests/draft-next/optional/float-overflow.json b/tests/draft-next/undefined/float-overflow.json similarity index 100% rename from tests/draft-next/optional/float-overflow.json rename to tests/draft-next/undefined/float-overflow.json diff --git a/tests/draft-next/optional/non-bmp-regex.json b/tests/draft-next/undefined/non-bmp-regex.json similarity index 100% rename from tests/draft-next/optional/non-bmp-regex.json rename to tests/draft-next/undefined/non-bmp-regex.json diff --git a/tests/draft-next/optional/refOfUnknownKeyword.json b/tests/draft-next/undefined/refOfUnknownKeyword.json similarity index 100% rename from tests/draft-next/optional/refOfUnknownKeyword.json rename to tests/draft-next/undefined/refOfUnknownKeyword.json From c1f1712006f1c7baabc1c5ddb26fba43968af856 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Thu, 23 Nov 2023 10:31:49 +1300 Subject: [PATCH 3/3] remove questions file --- tests/draft-next/optional/questions.md | 30 -------------------------- 1 file changed, 30 deletions(-) delete mode 100644 tests/draft-next/optional/questions.md diff --git a/tests/draft-next/optional/questions.md b/tests/draft-next/optional/questions.md deleted file mode 100644 index c41aba51..00000000 --- a/tests/draft-next/optional/questions.md +++ /dev/null @@ -1,30 +0,0 @@ -### `bignum` & `float-overflow` - -Are these tests in optional because the JSON spec makes a concession for environments that can't handle arbitrary numbers? While JSON Schema doesn't define any restrictions, it also doesn't make any such concessions. - -I've put them in _undefined/_ for now. - -References: -- https://datatracker.ietf.org/doc/html/rfc8259#section-6 -- https://json-schema.org/draft/2020-12/json-schema-validation#section-4.2 - -### `format-assertion` - -The spec isn't explicit on the requirement level for vocabularies as a feature. I'd (@gregsdennis) assume it's a MUST, but that's just an interpretation. - -There are requirement levels on `$vocabulary` and its usage, but nothing requiring that vocabularies be a supported feature in general. - -As such, I'm not sure where this should go. - -First, all of these tests assume that the `format-assertion` vocabulary is understood, which is optional. ("An implementation that supports the Format-Assertion vocabulary..." implies that implementations have the option to not support it.) - -Secondly, assuming the above, these test become mandatory because "full validation support" is a MUST requirement. - -I think this is a MAY overall, but could use confirmation. - -Also, we don't have any tests around _not_ understanding the `format-assertion` vocabulary. I think this is partially due to the fact that we can't handle error scenarios. - -References: -- https://json-schema.org/draft/2020-12/json-schema-core#section-4.3.3 -- https://json-schema.org/draft/2020-12/json-schema-core#section-8.1.2 -- https://json-schema.org/draft/2020-12/json-schema-validation#section-7.2.2 \ No newline at end of file