Skip to content

Commit

Permalink
Ref ignores adjacent keywords Draft 7 to 2019-09, correction in the r…
Browse files Browse the repository at this point in the history
…ules (#50)
  • Loading branch information
suprith-hub authored Aug 15, 2024
1 parent 15aacea commit 3a57333
Show file tree
Hide file tree
Showing 22 changed files with 60 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-draft7/to-2019-09/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" ] }
]
}
31 changes: 31 additions & 0 deletions test/from-draft7/to-2019-09/ref.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[
{
"title": "$ref present in schema, with adjacent keywords",
"from": {
"$id": "http://example.com",
"properties": {
"foo": {
"$ref": "/bar",
"type": "string",
"$id": "zoo"
},
"bar": {
"$id": "bar"
}
}
},
"to": {
"$id": "http://example.com",
"properties": {
"foo": {
"$ref": "/bar",
"x-type": "string",
"x-$id": "zoo"
},
"bar": {
"$id": "bar"
}
}
}
}
]

0 comments on commit 3a57333

Please sign in to comment.