Skip to content

Commit c73bf9c

Browse files
committed
Bounds
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent ef4dd25 commit c73bf9c

3 files changed

Lines changed: 165 additions & 0 deletions

File tree

test/evaluator/evaluator_2020_12.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2038,5 +2038,64 @@
20382038
"The array value contains 2 additional items not described by related keywords"
20392039
]
20402040
}
2041+
},
2042+
{
2043+
"description": "items_integer_bounded_8_boundary_values",
2044+
"schema": {
2045+
"$schema": "https://json-schema.org/draft/2020-12/schema",
2046+
"items": {
2047+
"type": "number",
2048+
"minimum": 0,
2049+
"maximum": 100
2050+
}
2051+
},
2052+
"instance": [ 0, 100 ],
2053+
"valid": true,
2054+
"fast": {
2055+
"pre": [
2056+
[ "LoopItemsIntegerBounded", "/items", "#/items", "" ]
2057+
],
2058+
"post": [
2059+
[ true, "LoopItemsIntegerBounded", "/items", "#/items", "" ]
2060+
],
2061+
"descriptions": [
2062+
"Every item in the array was expected to be a number within the given range"
2063+
]
2064+
},
2065+
"exhaustive": {
2066+
"pre": [
2067+
[ "LoopItemsFrom", "/items", "#/items", "" ],
2068+
[ "AssertionTypeStrictAny", "/items/type", "#/items/type", "/0" ],
2069+
[ "AssertionLessEqual", "/items/maximum", "#/items/maximum", "/0" ],
2070+
[ "AssertionGreaterEqual", "/items/minimum", "#/items/minimum", "/0" ],
2071+
[ "AssertionTypeStrictAny", "/items/type", "#/items/type", "/1" ],
2072+
[ "AssertionLessEqual", "/items/maximum", "#/items/maximum", "/1" ],
2073+
[ "AssertionGreaterEqual", "/items/minimum", "#/items/minimum", "/1" ],
2074+
[ "LogicalWhenArraySizeGreater", "/items", "#/items", "" ],
2075+
[ "Annotation", "/items", "#/items", "" ]
2076+
],
2077+
"post": [
2078+
[ true, "AssertionTypeStrictAny", "/items/type", "#/items/type", "/0" ],
2079+
[ true, "AssertionLessEqual", "/items/maximum", "#/items/maximum", "/0" ],
2080+
[ true, "AssertionGreaterEqual", "/items/minimum", "#/items/minimum", "/0" ],
2081+
[ true, "AssertionTypeStrictAny", "/items/type", "#/items/type", "/1" ],
2082+
[ true, "AssertionLessEqual", "/items/maximum", "#/items/maximum", "/1" ],
2083+
[ true, "AssertionGreaterEqual", "/items/minimum", "#/items/minimum", "/1" ],
2084+
[ true, "LoopItemsFrom", "/items", "#/items", "" ],
2085+
[ true, "Annotation", "/items", "#/items", "", true ],
2086+
[ true, "LogicalWhenArraySizeGreater", "/items", "#/items", "" ]
2087+
],
2088+
"descriptions": [
2089+
"The value was expected to be of type number",
2090+
"The integer value 0 was expected to be less than or equal to the integer 100",
2091+
"The integer value 0 was expected to be greater than or equal to the integer 0",
2092+
"The value was expected to be of type number",
2093+
"The integer value 100 was expected to be less than or equal to the integer 100",
2094+
"The integer value 100 was expected to be greater than or equal to the integer 0",
2095+
"Every item in the array value was expected to validate against the given subschema",
2096+
"Every item in the array value was successfully validated",
2097+
"The array value contains 2 additional items not described by related keywords"
2098+
]
2099+
}
20412100
}
20422101
]

test/evaluator/evaluator_draft4.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10023,5 +10023,58 @@
1002310023
"Every item in the array value was expected to validate against the given subschema"
1002410024
]
1002510025
}
10026+
},
10027+
{
10028+
"description": "items_integer_bounded_8_boundary_values",
10029+
"schema": {
10030+
"$schema": "http://json-schema.org/draft-04/schema#",
10031+
"items": {
10032+
"type": "number",
10033+
"minimum": 0,
10034+
"maximum": 100
10035+
}
10036+
},
10037+
"instance": [ 0, 100 ],
10038+
"valid": true,
10039+
"fast": {
10040+
"pre": [
10041+
[ "LoopItemsIntegerBounded", "/items", "#/items", "" ]
10042+
],
10043+
"post": [
10044+
[ true, "LoopItemsIntegerBounded", "/items", "#/items", "" ]
10045+
],
10046+
"descriptions": [
10047+
"Every item in the array was expected to be a number within the given range"
10048+
]
10049+
},
10050+
"exhaustive": {
10051+
"pre": [
10052+
[ "LoopItems", "/items", "#/items", "" ],
10053+
[ "AssertionLessEqual", "/items/maximum", "#/items/maximum", "/0" ],
10054+
[ "AssertionGreaterEqual", "/items/minimum", "#/items/minimum", "/0" ],
10055+
[ "AssertionTypeStrictAny", "/items/type", "#/items/type", "/0" ],
10056+
[ "AssertionLessEqual", "/items/maximum", "#/items/maximum", "/1" ],
10057+
[ "AssertionGreaterEqual", "/items/minimum", "#/items/minimum", "/1" ],
10058+
[ "AssertionTypeStrictAny", "/items/type", "#/items/type", "/1" ]
10059+
],
10060+
"post": [
10061+
[ true, "AssertionLessEqual", "/items/maximum", "#/items/maximum", "/0" ],
10062+
[ true, "AssertionGreaterEqual", "/items/minimum", "#/items/minimum", "/0" ],
10063+
[ true, "AssertionTypeStrictAny", "/items/type", "#/items/type", "/0" ],
10064+
[ true, "AssertionLessEqual", "/items/maximum", "#/items/maximum", "/1" ],
10065+
[ true, "AssertionGreaterEqual", "/items/minimum", "#/items/minimum", "/1" ],
10066+
[ true, "AssertionTypeStrictAny", "/items/type", "#/items/type", "/1" ],
10067+
[ true, "LoopItems", "/items", "#/items", "" ]
10068+
],
10069+
"descriptions": [
10070+
"The integer value 0 was expected to be less than or equal to the integer 100",
10071+
"The integer value 0 was expected to be greater than or equal to the integer 0",
10072+
"The value was expected to be of type number",
10073+
"The integer value 100 was expected to be less than or equal to the integer 100",
10074+
"The integer value 100 was expected to be greater than or equal to the integer 0",
10075+
"The value was expected to be of type number",
10076+
"Every item in the array value was expected to validate against the given subschema"
10077+
]
10078+
}
1002610079
}
1002710080
]

test/evaluator/evaluator_draft6.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3462,5 +3462,58 @@
34623462
"Every item in the array value was expected to validate against the given subschema"
34633463
]
34643464
}
3465+
},
3466+
{
3467+
"description": "items_integer_bounded_8_boundary_values",
3468+
"schema": {
3469+
"$schema": "http://json-schema.org/draft-06/schema#",
3470+
"items": {
3471+
"type": "number",
3472+
"minimum": 0,
3473+
"maximum": 100
3474+
}
3475+
},
3476+
"instance": [ 0, 100 ],
3477+
"valid": true,
3478+
"fast": {
3479+
"pre": [
3480+
[ "LoopItemsIntegerBounded", "/items", "#/items", "" ]
3481+
],
3482+
"post": [
3483+
[ true, "LoopItemsIntegerBounded", "/items", "#/items", "" ]
3484+
],
3485+
"descriptions": [
3486+
"Every item in the array was expected to be a number within the given range"
3487+
]
3488+
},
3489+
"exhaustive": {
3490+
"pre": [
3491+
[ "LoopItems", "/items", "#/items", "" ],
3492+
[ "AssertionLessEqual", "/items/maximum", "#/items/maximum", "/0" ],
3493+
[ "AssertionGreaterEqual", "/items/minimum", "#/items/minimum", "/0" ],
3494+
[ "AssertionTypeStrictAny", "/items/type", "#/items/type", "/0" ],
3495+
[ "AssertionLessEqual", "/items/maximum", "#/items/maximum", "/1" ],
3496+
[ "AssertionGreaterEqual", "/items/minimum", "#/items/minimum", "/1" ],
3497+
[ "AssertionTypeStrictAny", "/items/type", "#/items/type", "/1" ]
3498+
],
3499+
"post": [
3500+
[ true, "AssertionLessEqual", "/items/maximum", "#/items/maximum", "/0" ],
3501+
[ true, "AssertionGreaterEqual", "/items/minimum", "#/items/minimum", "/0" ],
3502+
[ true, "AssertionTypeStrictAny", "/items/type", "#/items/type", "/0" ],
3503+
[ true, "AssertionLessEqual", "/items/maximum", "#/items/maximum", "/1" ],
3504+
[ true, "AssertionGreaterEqual", "/items/minimum", "#/items/minimum", "/1" ],
3505+
[ true, "AssertionTypeStrictAny", "/items/type", "#/items/type", "/1" ],
3506+
[ true, "LoopItems", "/items", "#/items", "" ]
3507+
],
3508+
"descriptions": [
3509+
"The integer value 0 was expected to be less than or equal to the integer 100",
3510+
"The integer value 0 was expected to be greater than or equal to the integer 0",
3511+
"The value was expected to be of type number",
3512+
"The integer value 100 was expected to be less than or equal to the integer 100",
3513+
"The integer value 100 was expected to be greater than or equal to the integer 0",
3514+
"The value was expected to be of type number",
3515+
"Every item in the array value was expected to validate against the given subschema"
3516+
]
3517+
}
34653518
}
34663519
]

0 commit comments

Comments
 (0)