Skip to content
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

Add tests for enum validation with arrays of boolean values #712

Merged
merged 1 commit into from
Jan 16, 2024
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
96 changes: 96 additions & 0 deletions tests/draft-next/enum.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,30 @@
}
]
},
{
"description": "enum with [false] does not match [0]",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"enum": [[false]]
},
"tests": [
{
"description": "[false] is valid",
"data": [false],
"valid": true
},
{
"description": "[0] is invalid",
"data": [0],
"valid": false
},
{
"description": "[0.0] is invalid",
"data": [0.0],
"valid": false
}
]
},
{
"description": "enum with true does not match 1",
"schema": {
Expand All @@ -192,6 +216,30 @@
}
]
},
{
"description": "enum with [true] does not match [1]",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"enum": [[true]]
},
"tests": [
{
"description": "[true] is valid",
"data": [true],
"valid": true
},
{
"description": "[1] is invalid",
"data": [1],
"valid": false
},
{
"description": "[1.0] is invalid",
"data": [1.0],
"valid": false
}
]
},
{
"description": "enum with 0 does not match false",
"schema": {
Expand All @@ -216,6 +264,30 @@
}
]
},
{
"description": "enum with [0] does not match [false]",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"enum": [[0]]
},
"tests": [
{
"description": "[false] is invalid",
"data": [false],
"valid": false
},
{
"description": "[0] is valid",
"data": [0],
"valid": true
},
{
"description": "[0.0] is valid",
"data": [0.0],
"valid": true
}
]
},
{
"description": "enum with 1 does not match true",
"schema": {
Expand All @@ -240,6 +312,30 @@
}
]
},
{
"description": "enum with [1] does not match [true]",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"enum": [[1]]
},
"tests": [
{
"description": "[true] is invalid",
"data": [true],
"valid": false
},
{
"description": "[1] is valid",
"data": [1],
"valid": true
},
{
"description": "[1.0] is valid",
"data": [1.0],
"valid": true
}
]
},
{
"description": "nul characters in strings",
"schema": {
Expand Down
96 changes: 96 additions & 0 deletions tests/draft2019-09/enum.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,30 @@
}
]
},
{
"description": "enum with [false] does not match [0]",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"enum": [[false]]
},
"tests": [
{
"description": "[false] is valid",
"data": [false],
"valid": true
},
{
"description": "[0] is invalid",
"data": [0],
"valid": false
},
{
"description": "[0.0] is invalid",
"data": [0.0],
"valid": false
}
]
},
{
"description": "enum with true does not match 1",
"schema": {
Expand All @@ -192,6 +216,30 @@
}
]
},
{
"description": "enum with [true] does not match [1]",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"enum": [[true]]
},
"tests": [
{
"description": "[true] is valid",
"data": [true],
"valid": true
},
{
"description": "[1] is invalid",
"data": [1],
"valid": false
},
{
"description": "[1.0] is invalid",
"data": [1.0],
"valid": false
}
]
},
{
"description": "enum with 0 does not match false",
"schema": {
Expand All @@ -216,6 +264,30 @@
}
]
},
{
"description": "enum with [0] does not match [false]",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"enum": [[0]]
},
"tests": [
{
"description": "[false] is invalid",
"data": [false],
"valid": false
},
{
"description": "[0] is valid",
"data": [0],
"valid": true
},
{
"description": "[0.0] is valid",
"data": [0.0],
"valid": true
}
]
},
{
"description": "enum with 1 does not match true",
"schema": {
Expand All @@ -240,6 +312,30 @@
}
]
},
{
"description": "enum with [1] does not match [true]",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"enum": [[1]]
},
"tests": [
{
"description": "[true] is invalid",
"data": [true],
"valid": false
},
{
"description": "[1] is valid",
"data": [1],
"valid": true
},
{
"description": "[1.0] is valid",
"data": [1.0],
"valid": true
}
]
},
{
"description": "nul characters in strings",
"schema": {
Expand Down
96 changes: 96 additions & 0 deletions tests/draft2020-12/enum.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,30 @@
}
]
},
{
"description": "enum with [false] does not match [0]",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [[false]]
},
"tests": [
{
"description": "[false] is valid",
"data": [false],
"valid": true
},
{
"description": "[0] is invalid",
"data": [0],
"valid": false
},
{
"description": "[0.0] is invalid",
"data": [0.0],
"valid": false
}
]
},
{
"description": "enum with true does not match 1",
"schema": {
Expand All @@ -192,6 +216,30 @@
}
]
},
{
"description": "enum with [true] does not match [1]",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [[true]]
},
"tests": [
{
"description": "[true] is valid",
"data": [true],
"valid": true
},
{
"description": "[1] is invalid",
"data": [1],
"valid": false
},
{
"description": "[1.0] is invalid",
"data": [1.0],
"valid": false
}
]
},
{
"description": "enum with 0 does not match false",
"schema": {
Expand All @@ -216,6 +264,30 @@
}
]
},
{
"description": "enum with [0] does not match [false]",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [[0]]
},
"tests": [
{
"description": "[false] is invalid",
"data": [false],
"valid": false
},
{
"description": "[0] is valid",
"data": [0],
"valid": true
},
{
"description": "[0.0] is valid",
"data": [0.0],
"valid": true
}
]
},
{
"description": "enum with 1 does not match true",
"schema": {
Expand All @@ -240,6 +312,30 @@
}
]
},
{
"description": "enum with [1] does not match [true]",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [[1]]
},
"tests": [
{
"description": "[true] is invalid",
"data": [true],
"valid": false
},
{
"description": "[1] is valid",
"data": [1],
"valid": true
},
{
"description": "[1.0] is valid",
"data": [1.0],
"valid": true
}
]
},
{
"description": "nul characters in strings",
"schema": {
Expand Down
Loading