Skip to content

Commit

Permalink
Correct ordering rules draft 3 to 4
Browse files Browse the repository at this point in the history
  • Loading branch information
suprith-hub committed Aug 31, 2024
1 parent 96d3b2a commit ec0dcbe
Show file tree
Hide file tree
Showing 39 changed files with 441 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "$ref" },
{ "operation": "type-is", "path": [ {} ], "value": [ "array", "booelan", "integer", "number", "object", "string" ] }
],
"transform": [
{ "operation": "prefix-until-unique", "path": [ {} ], "value": "x-" }
]
}
10 changes: 10 additions & 0 deletions rules/from-draft3/to-draft4/002-ref-and-x-ref-present.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "$ref" },
{ "operation": "has-key", "path": [], "value": "x-$ref" }
],
"transform": [
{ "operation": "prefix-until-unique", "path": [ "x-$ref" ], "value": "x-" }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "x-$ref" }
],
"transform": [
{ "operation": "move", "to": [ "$ref" ], "from": [ "x-$ref" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "anyOf" }
],
"transform": [
{ "operation": "prefix-until-unique", "path": [ "anyOf" ], "value": "x-" }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "allOf" }
],
"transform": [
{ "operation": "prefix-until-unique", "path": [ "allOf" ], "value": "x-" }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "oneOf" }
],
"transform": [
{ "operation": "prefix-until-unique", "path": [ "oneOf" ], "value": "x-" }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "not" }
],
"transform": [
{ "operation": "prefix-until-unique", "path": [ "not" ], "value": "x-" }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "definitions" }
],
"transform": [
{ "operation": "prefix-until-unique", "path": [ "definitions" ], "value": "x-" }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "maxProperties" }
],
"transform": [
{ "operation": "prefix-until-unique", "path": [ "maxProperties" ], "value": "x-" }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "minProperties" }
],
"transform": [
{ "operation": "prefix-until-unique", "path": [ "minProperties" ], "value": "x-" }
]
}
10 changes: 10 additions & 0 deletions rules/from-draft3/to-draft4/011-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "$schema" },
{ "operation": "match-pattern", "path": [ "$schema" ], "value": "^http[s]?://json-schema.org/draft-03/schema[#]?$" }
],
"transform": [
{ "operation": "replace", "path": [ "$schema" ], "value": "http://json-schema.org/draft-04/schema#" }
]
}
10 changes: 10 additions & 0 deletions rules/from-draft3/to-draft4/012-type-has-value-equals-any.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "type" },
{ "operation": "equals", "path": [ "type" ], "value": "any" }
],
"transform": [
{ "operation": "remove", "path": [ "type" ] }
]
}
11 changes: 11 additions & 0 deletions rules/from-draft3/to-draft4/013-type-has-any-in-its-array.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "type" },
{ "operation": "type-is", "path": [ "type" ], "value": "array" },
{ "operation": "equals", "path": [ "type", {} ], "value": "any" }
],
"transform": [
{ "operation": "remove", "path": [ "type" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "type" },
{ "operation": "not-has-key", "path": [], "value": "anyOf" },
{ "operation": "type-is", "path": [ "type" ], "value": "array" },
{ "operation": "contains-type", "path": [ "type" ], "value": "object" }
],
"transform": [
{ "operation": "add", "path": [ "anyOf" ], "value": [] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "type" },
{ "operation": "type-is", "path": [ "type" ], "value": "array" },
{ "operation": "contains-type", "path": [ "type" ], "value": "object" },
{ "operation": "contains-type", "path": [ "type" ], "value": "string" }
],
"transform": [
{ "operation": "add", "path": [ "anyOf", "-" ], "value": { "type": [] } },
{ "operation": "add", "path": [ "type", "-" ], "value": true }
]
}
12 changes: 12 additions & 0 deletions rules/from-draft3/to-draft4/017-type-has-objects-in-its-array.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "type" },
{ "operation": "type-is", "path": [ "type" ], "value": "array" },
{ "operation": "has-key", "path": [], "value": "anyOf" },
{ "operation": "type-is", "path": [ "type", {} ], "value": "object" }
],
"transform": [
{ "operation": "remove-and-append", "to": [ "anyOf" ], "from": [ "type", {} ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "type" },
{ "operation": "type-is", "path": [ "type" ], "value": "array" },
{ "operation": "contains-type", "path": [ "type" ], "value": "object" },
{ "operation": "type-is", "path": [ "type", {} ], "value": "string" }
],
"transform": [
{ "operation": "remove", "path": [ "type", {} ] }
]
}
11 changes: 11 additions & 0 deletions rules/from-draft3/to-draft4/019-type-has-boolean-in-its-array.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "type" },
{ "operation": "type-is", "path": [ "type" ], "value": "array" },
{ "operation": "contains-type", "path": [ "type" ], "value": "boolean" }
],
"transform": [
{ "operation": "remove", "path": [ "type" ] }
]
}
10 changes: 10 additions & 0 deletions rules/from-draft3/to-draft4/020-type-is-an-empty-array.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "type" },
{ "operation": "size-equals", "path": [ "type" ], "value": 0 }
],
"transform": [
{ "operation": "remove", "path": [ "type" ] }
]
}
11 changes: 11 additions & 0 deletions rules/from-draft3/to-draft4/021-disallow-has-value-equals-any.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "disallow" },
{ "operation": "equals", "path": [ "disallow" ], "value": "any" }
],
"transform": [
{ "operation": "add", "path": [ "not" ], "value": {} },
{ "operation": "remove", "path": [ "disallow" ] }
]
}
11 changes: 11 additions & 0 deletions rules/from-draft3/to-draft4/022-disallow-has-any-in-its-array.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "disallow" },
{ "operation": "equals", "path": [ "disallow", {} ], "value": "any" }
],
"transform": [
{ "operation": "add", "path": [ "not" ], "value": {} },
{ "operation": "remove", "path": [ "disallow" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "disallow" },
{ "operation": "not-has-key", "path": [], "value": "allOf" },
{ "operation": "type-is", "path": [ "disallow" ], "value": "array" },
{ "operation": "contains-type", "path": [ "disallow" ], "value": "object" }
],
"transform": [
{ "operation": "add", "path": [ "allOf" ], "value": [] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "disallow" },
{ "operation": "has-key", "path": [], "value": "allOf" },
{ "operation": "type-is", "path": [ "disallow" ], "value": "array" },
{ "operation": "type-is", "path": [ "disallow", {} ], "value": "object" }
],
"transform": [
{ "operation": "add", "path": [ "allOf", "-" ], "value": { "not": "temp"} },
{ "operation": "move", "to": [ "allOf", "-", "not" ], "from": [ "disallow", {} ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "disallow" },
{ "operation": "type-is", "path": [ "disallow" ], "value": "array" },
{ "operation": "contains-type", "path": [ "disallow" ], "value": "string" },
{ "operation": "has-key", "path": [], "value": "allOf" }
],
"transform": [
{ "operation": "add", "path": [ "allOf", "-" ], "value": { "not": "temp" } },
{ "operation": "add", "path": [ "allOf", "-", "not" ], "value": { "type": "temp" } },
{ "operation": "move", "to": [ "allOf", "-", "not", "type" ], "from": [ "disallow" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "disallow" },
{ "operation": "type-is", "path": [ "disallow" ], "value": "array" },
{ "operation": "contains-type", "path": [ "disallow" ], "value": "string" },
{ "operation": "not-has-key", "path": [], "value": "allOf" }
],
"transform": [
{ "operation": "add", "path": [ "allOf" ], "value": [ { "not": { "type": "temp" } } ] },
{ "operation": "move", "to": [ "allOf", "-", "not", "type" ], "from": [ "disallow" ] }
]
}
11 changes: 11 additions & 0 deletions rules/from-draft3/to-draft4/027-disallow-is-an-empty-array.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "disallow" },
{ "operation": "type-is", "path": [ "disallow" ], "value": "array" },
{ "operation": "size-equals", "path": [ "disallow" ], "value": 0 }
],
"transform": [
{ "operation": "remove", "path": [ "disallow" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "dependencies" },
{ "operation": "type-is", "path": [ "dependencies", {} ], "value": "string" }
],
"transform": [
{ "operation": "remove-and-append", "from": [ "dependencies", {} ], "to": [ "dependencies", {} ] }
]
}
10 changes: 10 additions & 0 deletions rules/from-draft3/to-draft4/029-divisiblyBy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "divisibleBy" }
],
"transform": [
{ "operation": "replace-with-absolute", "path": [ "divisibleBy" ] },
{ "operation": "move", "to": [ "multipleOf" ], "from": [ "divisibleBy" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "extends" },
{ "operation": "type-is", "path": [ "extends" ], "value": "array" },
{ "operation": "type-is", "path": [ "extends", {} ], "value": "object" },
{ "operation": "not-has-key", "path": [], "value": "allOf" }
],
"transform": [
{ "operation": "add", "path": [ "allOf" ], "value": [] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "extends" },
{ "operation": "type-is", "path": [ "extends" ], "value": "array" },
{ "operation": "type-is", "path": [ "extends", {} ], "value": "object" },
{ "operation": "has-key", "path": [], "value": "allOf" }
],
"transform": [
{ "operation": "remove-and-append", "to": [ "allOf" ], "from": [ "extends", {} ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "extends" },
{ "operation": "type-is", "path": [ "extends" ], "value": "object" },
{ "operation": "not-has-key", "path": [], "value": "allOf" }
],
"transform": [
{ "operation": "add", "path": [ "allOf" ], "value": [ "temp" ] },
{ "operation": "move", "to": [ "allOf", "-" ], "from": [ "extends" ] }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "extends" },
{ "operation": "type-is", "path": [ "extends" ], "value": "object" },
{ "operation": "has-key", "path": [], "value": "allOf" }
],
"transform": [
{ "operation": "add", "path": [ "allOf", "-" ], "value": "temp" },
{ "operation": "move", "to": [ "allOf", "-" ], "from": [ "extends" ] }
]
}
10 changes: 10 additions & 0 deletions rules/from-draft3/to-draft4/034-empty-extends-array.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"vocabulary": "core",
"condition": [
{ "operation": "has-key", "path": [], "value": "extends" },
{ "operation": "size-equals", "path": [ "extends" ], "value": 0 }
],
"transform": [
{ "operation": "remove", "path": [ "extends" ] }
]
}
Loading

0 comments on commit ec0dcbe

Please sign in to comment.