Skip to content

test that format-assertions are valid with non-string types #512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion tests/draft-future/optional/format/date-time.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,38 @@
[
{
"description": "validation of date-time strings",
"schema": {"format": "date-time"},
"schema": { "format": "date-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 date-time string",
"data": "1963-06-19T08:30:06.283185Z",
Expand Down Expand Up @@ -33,6 +63,11 @@
"data": "1990-12-31T15:59:60-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",
Expand Down
32 changes: 31 additions & 1 deletion tests/draft-future/optional/format/date.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,38 @@
[
{
"description": "validation of date strings",
"schema": {"format": "date"},
"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",
Expand Down
32 changes: 31 additions & 1 deletion tests/draft-future/optional/format/duration.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,38 @@
[
{
"description": "validation of duration strings",
"schema": {"format": "duration"},
"schema": { "format": "duration" },
"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 duration string",
"data": "P4DT12H30M5S",
Expand Down
32 changes: 31 additions & 1 deletion tests/draft-future/optional/format/email.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,38 @@
[
{
"description": "validation of e-mail addresses",
"schema": {"format": "email"},
"schema": { "format": "email" },
"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 e-mail address",
"data": "[email protected]",
Expand Down
32 changes: 31 additions & 1 deletion tests/draft-future/optional/format/hostname.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,38 @@
[
{
"description": "validation of host names",
"schema": {"format": "hostname"},
"schema": { "format": "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",
"data": "www.example.com",
Expand Down
32 changes: 31 additions & 1 deletion tests/draft-future/optional/format/idn-email.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,38 @@
[
{
"description": "validation of an internationalized e-mail addresses",
"schema": {"format": "idn-email"},
"schema": { "format": "idn-email" },
"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 idn e-mail ([email protected] in Hangul)",
"data": "실례@실례.테스트",
Expand Down
30 changes: 30 additions & 0 deletions tests/draft-future/optional/format/idn-hostname.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,36 @@
"description": "validation of internationalized host names",
"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": "실례.테스트",
Expand Down
32 changes: 31 additions & 1 deletion tests/draft-future/optional/format/ipv4.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,38 @@
[
{
"description": "validation of IP addresses",
"schema": {"format": "ipv4"},
"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",
Expand Down
32 changes: 31 additions & 1 deletion tests/draft-future/optional/format/ipv6.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,38 @@
[
{
"description": "validation of IPv6 addresses",
"schema": {"format": "ipv6"},
"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",
Expand Down
Loading