Skip to content

Commit

Permalink
Add contains all the cases tests and rules respectively (#16)
Browse files Browse the repository at this point in the history
I think I should further split the PR?
  • Loading branch information
suprith-hub authored Jun 26, 2024
1 parent 7bba78a commit 64082d8
Show file tree
Hide file tree
Showing 16 changed files with 332 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"vocabulary": [
"https://json-schema.org/draft/2019-09/vocab/applicator",
"https://json-schema.org/draft/2019-09/vocab/validation"
],
"condition": [
{ "operation": "has-key", "path": [], "value": "contains" },
{ "operation": "has-key", "path": [], "value": "maxContains" },
{ "operation": "has-key", "path": [], "value": "minContains" },
{ "operation": "not-has-key", "path": [], "value": "allOf" }
],
"transform": [
{ "operation": "add", "path": [ "allOf" ], "value": [] },
{ "operation": "add", "path": [ "allOf" , "-"], "value": { "not": { "not": { "contains": "temp" } } } },
{ "operation": "move", "to": [ "allOf" , "-", "not", "not", "contains" ], "from": [ "contains" ] },
{ "operation": "move", "to": [ "allOf" , "-", "not", "not", "maxContains" ], "from": [ "maxContains" ] },
{ "operation": "move", "to": [ "allOf" , "-", "not", "not", "minContains" ], "from": [ "minContains" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"vocabulary": [
"https://json-schema.org/draft/2019-09/vocab/applicator",
"https://json-schema.org/draft/2019-09/vocab/validation"
],
"condition": [
{ "operation": "has-key", "path": [], "value": "contains" },
{ "operation": "has-key", "path": [], "value": "maxContains" },
{ "operation": "has-key", "path": [], "value": "minContains" },
{ "operation": "has-key", "path": [], "value": "allOf" }
],
"transform": [
{ "operation": "add", "path": [ "allOf" , "-"], "value": { "not": { "not": { "contains": "temp" } } } },
{ "operation": "move", "to": [ "allOf" , "-", "not", "not", "contains" ], "from": [ "contains" ] },
{ "operation": "move", "to": [ "allOf" , "-", "not", "not", "maxContains" ], "from": [ "maxContains" ] },
{ "operation": "move", "to": [ "allOf" , "-", "not", "not", "minContains" ], "from": [ "minContains" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"vocabulary": [
"https://json-schema.org/draft/2019-09/vocab/applicator",
"https://json-schema.org/draft/2019-09/vocab/validation"
],
"condition": [
{ "operation": "has-key", "path": [], "value": "contains" },
{ "operation": "has-key", "path": [], "value": "maxContains" },
{ "operation": "not-has-key", "path": [], "value": "minContains" },
{ "operation": "not-has-key", "path": [], "value": "allOf" }
],
"transform": [
{ "operation": "add", "path": [ "allOf" ], "value": [] },
{ "operation": "add", "path": [ "allOf" , "-"], "value": { "not": { "not": { "contains": "temp" } } } },
{ "operation": "move", "to": [ "allOf" , "-", "not", "not", "contains" ], "from": [ "contains" ] },
{ "operation": "move", "to": [ "allOf" , "-", "not", "not", "maxContains" ], "from": [ "maxContains" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"vocabulary": [
"https://json-schema.org/draft/2019-09/vocab/applicator",
"https://json-schema.org/draft/2019-09/vocab/validation"
],
"condition": [
{ "operation": "has-key", "path": [], "value": "contains" },
{ "operation": "has-key", "path": [], "value": "maxContains" },
{ "operation": "not-has-key", "path": [], "value": "minContains" },
{ "operation": "has-key", "path": [], "value": "allOf" }
],
"transform": [
{ "operation": "add", "path": [ "allOf" , "-"], "value": { "not": { "not": { "contains": "temp" } } } },
{ "operation": "move", "to": [ "allOf" , "-", "not", "not", "contains" ], "from": [ "contains" ] },
{ "operation": "move", "to": [ "allOf" , "-", "not", "not", "maxContains" ], "from": [ "maxContains" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"vocabulary": [
"https://json-schema.org/draft/2019-09/vocab/applicator",
"https://json-schema.org/draft/2019-09/vocab/validation"
],
"condition": [
{ "operation": "has-key", "path": [], "value": "contains" },
{ "operation": "has-key", "path": [], "value": "minContains" },
{ "operation": "not-has-key", "path": [], "value": "maxContains" },
{ "operation": "not-has-key", "path": [], "value": "allOf" }
],
"transform": [
{ "operation": "add", "path": [ "allOf" ], "value": [] },
{ "operation": "add", "path": [ "allOf" , "-"], "value": { "not": { "not": { "contains": "temp" } } } },
{ "operation": "move", "to": [ "allOf" , "-", "not", "not", "contains" ], "from": [ "contains" ] },
{ "operation": "move", "to": [ "allOf" , "-", "not", "not", "minContains" ], "from": [ "minContains" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"vocabulary": [
"https://json-schema.org/draft/2019-09/vocab/applicator",
"https://json-schema.org/draft/2019-09/vocab/validation"
],
"condition": [
{ "operation": "has-key", "path": [], "value": "contains" },
{ "operation": "has-key", "path": [], "value": "minContains" },
{ "operation": "not-has-key", "path": [], "value": "maxContains" },
{ "operation": "has-key", "path": [], "value": "allOf" }
],
"transform": [
{ "operation": "add", "path": [ "allOf" , "-"], "value": { "not": { "not": { "contains": "temp" } } } },
{ "operation": "move", "to": [ "allOf" , "-", "not", "not", "contains" ], "from": [ "contains" ] },
{ "operation": "move", "to": [ "allOf" , "-", "not", "not", "minContains" ], "from": [ "minContains" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"vocabulary": [
"https://json-schema.org/draft/2019-09/vocab/applicator",
"https://json-schema.org/draft/2019-09/vocab/validation"
],
"condition": [
{ "operation": "has-key", "path": [], "value": "contains" },
{ "operation": "not-has-key", "path": [], "value": "minContains" },
{ "operation": "not-has-key", "path": [], "value": "maxContains" },
{ "operation": "not-has-key", "path": [], "value": "allOf" }
],
"transform": [
{ "operation": "add", "path": [ "allOf" ], "value": [] },
{ "operation": "add", "path": [ "allOf" , "-"], "value": { "not": { "not": { "contains": "temp" } } } },
{ "operation": "move", "to": [ "allOf" , "-", "not", "not", "contains" ], "from": [ "contains" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"vocabulary": [
"https://json-schema.org/draft/2019-09/vocab/applicator",
"https://json-schema.org/draft/2019-09/vocab/validation"
],
"condition": [
{ "operation": "has-key", "path": [], "value": "contains" },
{ "operation": "not-has-key", "path": [], "value": "minContains" },
{ "operation": "not-has-key", "path": [], "value": "maxContains" },
{ "operation": "has-key", "path": [], "value": "allOf" }
],
"transform": [
{ "operation": "add", "path": [ "allOf" , "-"], "value": { "not": { "not": { "contains": "temp" } } } },
{ "operation": "move", "to": [ "allOf" , "-", "not", "not", "contains" ], "from": [ "contains" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[
{
"title": "`contains` keyword having schema with maxContains and minContains, allOf is absent",
"from": {
"contains": { "type": "string" },
"maxContains": 2,
"minContains": 1,
"unevaluatedItems": false
},
"to": {
"allOf": [
{
"not": {
"not": {
"contains": { "type": "string" },
"maxContains": 2,
"minContains": 1
}
}
}
],
"unevaluatedItems": false
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[
{
"title": "`contains` keyword having schema with maxContains and minContains, allOf is present",
"from": {
"contains": { "type": "string" },
"maxContains": 2,
"minContains": 1,
"unevaluatedItems": false,
"allOf": [ {} ]
},
"to": {
"allOf": [
{},
{
"not": {
"not": {
"contains": { "type": "string" },
"maxContains": 2,
"minContains": 1
}
}
}
],
"unevaluatedItems": false
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"title": "`contains` keyword having schema with maxContains and without minContains, allOf is absent",
"from": {
"contains": { "type": "string" },
"maxContains": 2,
"unevaluatedItems": false
},
"to": {
"allOf": [
{
"not": {
"not": {
"contains": { "type": "string" },
"maxContains": 2
}
}
}
],
"unevaluatedItems": false
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[
{
"title": "`contains` keyword having schema with maxContains and without minContains, allOf is present",
"from": {
"contains": { "type": "string" },
"maxContains": 2,
"unevaluatedItems": false,
"allOf": [ {} ]
},
"to": {
"allOf": [
{},
{
"not": {
"not": {
"contains": { "type": "string" },
"maxContains": 2
}
}
}
],
"unevaluatedItems": false
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"title": "`contains` keyword having schema with and minContains without maxContains, allOf is absent",
"from": {
"contains": { "type": "string" },
"minContains": 2,
"unevaluatedItems": false
},
"to": {
"allOf": [
{
"not": {
"not": {
"contains": { "type": "string" },
"minContains": 2
}
}
}
],
"unevaluatedItems": false
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[
{
"title": "`contains` keyword having schema with and minContains without maxContains, allOf is present",
"from": {
"contains": { "type": "string" },
"minContains": 2,
"unevaluatedItems": false,
"allOf": [ {} ]
},
"to": {
"allOf": [
{},
{
"not": {
"not": {
"contains": { "type": "string" },
"minContains": 2
}
}
}
],
"unevaluatedItems": false
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[
{
"title": "`contains` keyword having schema without both maxContains and minContains, allOf is absent",
"from": {
"contains": { "type": "string" },
"unevaluatedItems": false
},
"to": {
"allOf": [
{
"not": {
"not": {
"contains": { "type": "string" }
}
}
}
],
"unevaluatedItems": false
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"title": "`contains` keyword having schema without both maxContains and minContains, allOf is present",
"from": {
"contains": { "type": "string" },
"unevaluatedItems": false,
"allOf": [ {} ]
},
"to": {
"allOf": [
{},
{
"not": {
"not": {
"contains": { "type": "string" }
}
}
}
],
"unevaluatedItems": false
}
}
]

0 comments on commit 64082d8

Please sign in to comment.