Skip to content

Commit

Permalink
Squashed 'json/' changes from 217bf81b..544f7c3d
Browse files Browse the repository at this point in the history
544f7c3d Merge pull request #712 from otto-ifak/main
9dad3ebe Add tests for enum with array of bool
589a0858 Merge pull request #706 from marksparkza/unevaluated-before-ref
64d5cab9 Merge pull request #710 from spacether/patch-1
418cdbd6 Removes idea folder
e0a9e066 Updates all other tests to mention grapheme/graphemes
69136952 Update minLength.json
4a2c61e8 Test unevaluatedItems|Properties before $ref

git-subtree-dir: json
git-subtree-split: 544f7c3df93b69f84f587b345f2835c380e43226
  • Loading branch information
Julian committed Jan 16, 2024
1 parent 3e46f22 commit 74dfd48
Show file tree
Hide file tree
Showing 26 changed files with 761 additions and 14 deletions.
96 changes: 96 additions & 0 deletions json/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
2 changes: 1 addition & 1 deletion json/tests/draft-next/maxLength.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"valid": true
},
{
"description": "two supplementary Unicode code points is long enough",
"description": "two graphemes is long enough",
"data": "\uD83D\uDCA9\uD83D\uDCA9",
"valid": true
}
Expand Down
2 changes: 1 addition & 1 deletion json/tests/draft-next/minLength.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"valid": true
},
{
"description": "one supplementary Unicode code point is not long enough",
"description": "one grapheme is not long enough",
"data": "\uD83D\uDCA9",
"valid": false
}
Expand Down
31 changes: 31 additions & 0 deletions json/tests/draft-next/unevaluatedItems.json
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,37 @@
}
]
},
{
"description": "unevaluatedItems before $ref",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"unevaluatedItems": false,
"prefixItems": [
{ "type": "string" }
],
"$ref": "#/$defs/bar",
"$defs": {
"bar": {
"prefixItems": [
true,
{ "type": "string" }
]
}
}
},
"tests": [
{
"description": "with no unevaluated items",
"data": ["foo", "bar"],
"valid": true
},
{
"description": "with unevaluated items",
"data": ["foo", "bar", "baz"],
"valid": false
}
]
},
{
"description": "unevaluatedItems with $dynamicRef",
"schema": {
Expand Down
38 changes: 38 additions & 0 deletions json/tests/draft-next/unevaluatedProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,44 @@
}
]
},
{
"description": "unevaluatedProperties before $ref",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"type": "object",
"unevaluatedProperties": false,
"properties": {
"foo": { "type": "string" }
},
"$ref": "#/$defs/bar",
"$defs": {
"bar": {
"properties": {
"bar": { "type": "string" }
}
}
}
},
"tests": [
{
"description": "with no unevaluated properties",
"data": {
"foo": "foo",
"bar": "bar"
},
"valid": true
},
{
"description": "with unevaluated properties",
"data": {
"foo": "foo",
"bar": "bar",
"baz": "baz"
},
"valid": false
}
]
},
{
"description": "unevaluatedProperties with $dynamicRef",
"schema": {
Expand Down
96 changes: 96 additions & 0 deletions json/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
2 changes: 1 addition & 1 deletion json/tests/draft2019-09/maxLength.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"valid": true
},
{
"description": "two supplementary Unicode code points is long enough",
"description": "two graphemes is long enough",
"data": "\uD83D\uDCA9\uD83D\uDCA9",
"valid": true
}
Expand Down
2 changes: 1 addition & 1 deletion json/tests/draft2019-09/minLength.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"valid": true
},
{
"description": "one supplementary Unicode code point is not long enough",
"description": "one grapheme is not long enough",
"data": "\uD83D\uDCA9",
"valid": false
}
Expand Down
Loading

0 comments on commit 74dfd48

Please sign in to comment.