generated from json-schema-org/repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transform various keywords from Draft 4 to Draft 6 (#40)
- Loading branch information
1 parent
a226338
commit f2f24b1
Showing
14 changed files
with
268 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
rules/from-draft4/to-draft6/001-unknown-in-previous-draft-const.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"vocabulary": "validation", | ||
"condition": [ | ||
{ "operation": "has-key", "path": [], "value": "const" } | ||
], | ||
"transform": [ | ||
{ "operation": "prefix-until-unique", "path": [ "const" ], "value": "x-" } | ||
] | ||
} |
9 changes: 9 additions & 0 deletions
9
rules/from-draft4/to-draft6/002-unknown-in-previous-draft-contains.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"vocabulary": "validation", | ||
"condition": [ | ||
{ "operation": "has-key", "path": [], "value": "contains" } | ||
], | ||
"transform": [ | ||
{ "operation": "prefix-until-unique", "path": [ "contains" ], "value": "x-" } | ||
] | ||
} |
9 changes: 9 additions & 0 deletions
9
rules/from-draft4/to-draft6/003-unknown-in-previous-draft-examples.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"vocabulary": "validation", | ||
"condition": [ | ||
{ "operation": "has-key", "path": [], "value": "examples" } | ||
], | ||
"transform": [ | ||
{ "operation": "prefix-until-unique", "path": [ "examples" ], "value": "x-" } | ||
] | ||
} |
9 changes: 9 additions & 0 deletions
9
rules/from-draft4/to-draft6/004-unknown-in-previous-draft-propertyNames.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"vocabulary": "valildation", | ||
"condition": [ | ||
{ "operation": "has-key", "path": [], "value": "propertyNames" } | ||
], | ||
"transform": [ | ||
{ "operation": "prefix-until-unique", "path": [ "propertyNames" ], "value": "x-" } | ||
] | ||
} |
9 changes: 9 additions & 0 deletions
9
rules/from-draft4/to-draft6/005-unknown-in-previous-draft-$id.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"vocabulary": "core", | ||
"condition": [ | ||
{ "operation": "has-key", "path": [], "value": "$id" } | ||
], | ||
"transform": [ | ||
{ "operation": "prefix-until-unique", "path": [ "$id" ], "value": "x-" } | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-04/schema[#]?$" } | ||
], | ||
"transform": [ | ||
{ "operation": "replace", "path": [ "$schema" ], "value": "http://json-schema.org/draft-06/schema#" } | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"vocabulary": "core", | ||
"condition": [ | ||
{ "operation": "has-key", "path": [], "value": "id" } | ||
], | ||
"transform": [ | ||
{ "operation": "move", "to": [ "$id" ], "from": [ "id" ] } | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[ | ||
{ | ||
"title": "id present in the schema", | ||
"from": { | ||
"id": "http://example.com" | ||
}, | ||
"to": { | ||
"$id": "http://example.com" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
[ | ||
{ | ||
"title": "Simple matching schema", | ||
"from": { | ||
"$schema": "https://json-schema.org/draft-04/schema#" | ||
}, | ||
"to": { | ||
"$schema": "http://json-schema.org/draft-06/schema#" | ||
} | ||
}, | ||
{ | ||
"title": "Simple non matching schema", | ||
"from": { | ||
"$schema": "http://json-schema.org/draft-06/schema#" | ||
}, | ||
"to": { | ||
"$schema": "http://json-schema.org/draft-06/schema#" | ||
} | ||
}, | ||
{ | ||
"title": "Nested matching schema", | ||
"from": { | ||
"$schema": "https://json-schema.org/draft-04/schema#", | ||
"definitions": { | ||
"foo": { | ||
"$schema": "https://json-schema.org/draft-04/schema#" | ||
} | ||
} | ||
}, | ||
"to": { | ||
"$schema": "http://json-schema.org/draft-06/schema#", | ||
"definitions": { | ||
"foo": { | ||
"$schema": "http://json-schema.org/draft-06/schema#" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"title": "Nested half matching schema", | ||
"from": { | ||
"$schema": "http://json-schema.org/draft-06/schema#", | ||
"definitions": { | ||
"foo": { | ||
"$schema": "https://json-schema.org/draft-04/schema#" | ||
} | ||
} | ||
}, | ||
"to": { | ||
"$schema": "http://json-schema.org/draft-06/schema#", | ||
"definitions": { | ||
"foo": { | ||
"$schema": "http://json-schema.org/draft-06/schema#" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"title": "$schema inside unknown keyword", | ||
"from": { | ||
"$schema": "https://json-schema.org/draft-04/schema#", | ||
"foo": { | ||
"$schema": "https://json-schema.org/draft-04/schema#" | ||
} | ||
}, | ||
"to": { | ||
"$schema": "http://json-schema.org/draft-06/schema#", | ||
"foo": { | ||
"$schema": "https://json-schema.org/draft-04/schema#" | ||
} | ||
} | ||
} | ||
] |
24 changes: 24 additions & 0 deletions
24
test/from-draft4/to-draft6/unknown-in-previous-draft-$id.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[ | ||
{ | ||
"title": "$id present in the schema", | ||
"from": { | ||
"$id": "newbie" | ||
}, | ||
"to": { | ||
"x-$id": "newbie" | ||
} | ||
}, | ||
{ | ||
"title": "$id with $id having `x-` as prefix", | ||
"from": { | ||
"x-$id": "expert", | ||
"x-x-$id": "master", | ||
"$id": "newbie" | ||
}, | ||
"to": { | ||
"x-$id": "expert", | ||
"x-x-$id": "master", | ||
"x-x-x-$id": "newbie" | ||
} | ||
} | ||
] |
24 changes: 24 additions & 0 deletions
24
test/from-draft4/to-draft6/unknown-in-previous-draft-const.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[ | ||
{ | ||
"title": "const present in the schema", | ||
"from": { | ||
"const": "newbie" | ||
}, | ||
"to": { | ||
"x-const": "newbie" | ||
} | ||
}, | ||
{ | ||
"title": "const with const having `x-` as prefix", | ||
"from": { | ||
"x-const": "expert", | ||
"x-x-const": "master", | ||
"const": "newbie" | ||
}, | ||
"to": { | ||
"x-const": "expert", | ||
"x-x-const": "master", | ||
"x-x-x-const": "newbie" | ||
} | ||
} | ||
] |
24 changes: 24 additions & 0 deletions
24
test/from-draft4/to-draft6/unknown-in-previous-draft-contains.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[ | ||
{ | ||
"title": "contains present in the schema", | ||
"from": { | ||
"contains": "newbie" | ||
}, | ||
"to": { | ||
"x-contains": "newbie" | ||
} | ||
}, | ||
{ | ||
"title": "contains with contains having `x-` as prefix", | ||
"from": { | ||
"x-contains": "expert", | ||
"x-x-contains": "master", | ||
"contains": "newbie" | ||
}, | ||
"to": { | ||
"x-contains": "expert", | ||
"x-x-contains": "master", | ||
"x-x-x-contains": "newbie" | ||
} | ||
} | ||
] |
24 changes: 24 additions & 0 deletions
24
test/from-draft4/to-draft6/unknown-in-previous-draft-examples.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[ | ||
{ | ||
"title": "examples present in the schema", | ||
"from": { | ||
"examples": "newbie" | ||
}, | ||
"to": { | ||
"x-examples": "newbie" | ||
} | ||
}, | ||
{ | ||
"title": "examples with examples having `x-` as prefix", | ||
"from": { | ||
"x-examples": "expert", | ||
"x-x-examples": "master", | ||
"examples": "newbie" | ||
}, | ||
"to": { | ||
"x-examples": "expert", | ||
"x-x-examples": "master", | ||
"x-x-x-examples": "newbie" | ||
} | ||
} | ||
] |
24 changes: 24 additions & 0 deletions
24
test/from-draft4/to-draft6/unknown-in-previous-draft-propertyNames.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[ | ||
{ | ||
"title": "propertyNames present in the schema", | ||
"from": { | ||
"propertyNames": "newbie" | ||
}, | ||
"to": { | ||
"x-propertyNames": "newbie" | ||
} | ||
}, | ||
{ | ||
"title": "propertyNames with propertyNames having `x-` as prefix", | ||
"from": { | ||
"x-propertyNames": "expert", | ||
"x-x-propertyNames": "master", | ||
"propertyNames": "newbie" | ||
}, | ||
"to": { | ||
"x-propertyNames": "expert", | ||
"x-x-propertyNames": "master", | ||
"x-x-x-propertyNames": "newbie" | ||
} | ||
} | ||
] |