Skip to content

Commit

Permalink
Add rules and tests for excusive Maximum and Minimum draft 4 to 6
Browse files Browse the repository at this point in the history
  • Loading branch information
suprith-hub committed Jul 25, 2024
1 parent 7071521 commit 0b6c2ba
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rules/from-draft4/to-draft6/008-exclusiveMaximum-boolean-true.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"vocabulary": "validation",
"condition": [
{ "operation": "has-key", "path": [], "value": "exclusiveMaximum" },
{ "operation": "equals", "path": [ "exclusiveMaximum" ], "value": true },
{ "operation": "has-key", "path": [], "value": "maximum" }
],
"transform": [
{ "operation": "copy", "to": [ "exclusiveMaximum" ], "from": [ "maximum" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"vocabulary": "validation",
"condition": [
{ "operation": "has-key", "path": [], "value": "exclusiveMaximum" },
{ "operation": "equals", "path": [ "exclusiveMaximum" ], "value": false }
],
"transform": [
{ "operation": "remove", "path": [ "exclusiveMaximum" ] }
]
}
11 changes: 11 additions & 0 deletions rules/from-draft4/to-draft6/010-exclusiveMinimum-boolean-true.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"vocabulary": "validation",
"condition": [
{ "operation": "has-key", "path": [], "value": "exclusiveMinimum" },
{ "operation": "equals", "path": [ "exclusiveMinimum" ], "value": true },
{ "operation": "has-key", "path": [], "value": "minimum" }
],
"transform": [
{ "operation": "copy", "to": [ "exclusiveMinimum" ], "from": [ "minimum" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"vocabulary": "validation",
"condition": [
{ "operation": "has-key", "path": [], "value": "exclusiveMinimum" },
{ "operation": "equals", "path": [ "exclusiveMinimum" ], "value": false }
],
"transform": [
{ "operation": "remove", "path": [ "exclusiveMinimum" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"title": "exclusiveMaximum present in the schema and value equals false",
"from": {
"exclusiveMaximum": false
},
"to": {}
}
]
13 changes: 13 additions & 0 deletions test/from-draft4/to-draft6/exclusiveMaximum-boolean-true.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"title": "exclusiveMaximum and maximum present in the schema and exclusiveMaximum equals true",
"from": {
"exclusiveMaximum": true,
"maximum": 3
},
"to": {
"exclusiveMaximum": 3,
"maximum": 3
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"title": "exclusiveMinimum present in the schema and value equals false",
"from": {
"exclusiveMinimum": false
},
"to": {}
}
]
13 changes: 13 additions & 0 deletions test/from-draft4/to-draft6/exclusiveMinimum-boolean-true.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"title": "exclusiveMinimum and minimum present in the schema and exclusiveMinimum equals true",
"from": {
"exclusiveMinimum": true,
"minimum": 3
},
"to": {
"exclusiveMinimum": 3,
"minimum": 3
}
}
]

0 comments on commit 0b6c2ba

Please sign in to comment.