Skip to content

Commit

Permalink
Merge commit 'eb56578c253ff39b20986aabf48f34193be15457'
Browse files Browse the repository at this point in the history
* commit 'eb56578c253ff39b20986aabf48f34193be15457':
  Squashed 'json/' changes from b069ac352..5cc9214e8
  • Loading branch information
Julian committed Aug 3, 2023
2 parents 4e999e0 + eb56578 commit 8a55721
Show file tree
Hide file tree
Showing 14 changed files with 342 additions and 56 deletions.
13 changes: 13 additions & 0 deletions json/remotes/draft-next/detached-dynamicref.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$id": "http://localhost:1234/draft-next/detached-dynamicref.json",
"$schema": "https://json-schema.org/draft/next/schema",
"$defs": {
"foo": {
"$dynamicRef": "#detached"
},
"detached": {
"$dynamicAnchor": "detached",
"type": "integer"
}
}
}
13 changes: 13 additions & 0 deletions json/remotes/draft-next/detached-ref.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$id": "http://localhost:1234/draft-next/detached-ref.json",
"$schema": "https://json-schema.org/draft/next/schema",
"$defs": {
"foo": {
"$ref": "#detached"
},
"detached": {
"$anchor": "detached",
"type": "integer"
}
}
}
13 changes: 13 additions & 0 deletions json/remotes/draft2019-09/detached-ref.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$id": "http://localhost:1234/draft2019-09/detached-ref.json",
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$defs": {
"foo": {
"$ref": "#detached"
},
"detached": {
"$anchor": "detached",
"type": "integer"
}
}
}
13 changes: 13 additions & 0 deletions json/remotes/draft2020-12/detached-dynamicref.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$id": "http://localhost:1234/draft2020-12/detached-dynamicref.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"foo": {
"$dynamicRef": "#detached"
},
"detached": {
"$dynamicAnchor": "detached",
"type": "integer"
}
}
}
13 changes: 13 additions & 0 deletions json/remotes/draft2020-12/detached-ref.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$id": "http://localhost:1234/draft2020-12/detached-ref.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"foo": {
"$ref": "#detached"
},
"detached": {
"$anchor": "detached",
"type": "integer"
}
}
}
13 changes: 13 additions & 0 deletions json/remotes/draft6/detached-ref.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$id": "http://localhost:1234/draft6/detached-ref.json",
"$schema": "http://json-schema.org/draft-06/schema#",
"definitions": {
"foo": {
"$ref": "#detached"
},
"detached": {
"$id": "#detached",
"type": "integer"
}
}
}
13 changes: 13 additions & 0 deletions json/remotes/draft7/detached-ref.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$id": "http://localhost:1234/draft7/detached-ref.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"foo": {
"$ref": "#detached"
},
"detached": {
"$id": "#detached",
"type": "integer"
}
}
}
104 changes: 76 additions & 28 deletions json/tests/draft-next/dynamicRef.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,45 +207,75 @@
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$id": "https://test.json-schema.org/dynamic-ref-with-multiple-paths/main",
"$defs": {
"inner": {
"$id": "inner",
"$dynamicAnchor": "foo",
"title": "inner",
"additionalProperties": {
"$dynamicRef": "#foo"
}
"propertyDependencies": {
"kindOfList": {
"numbers": { "$ref": "numberList" },
"strings": { "$ref": "stringList" }
}
},
"if": {
"propertyNames": {
"pattern": "^[a-m]"
"$defs": {
"genericList": {
"$id": "genericList",
"properties": {
"list": {
"items": { "$dynamicRef": "#itemType" }
}
}
},
"numberList": {
"$id": "numberList",
"$defs": {
"itemType": {
"$dynamicAnchor": "itemType",
"type": "number"
}
},
"$ref": "genericList"
},
"stringList": {
"$id": "stringList",
"$defs": {
"itemType": {
"$dynamicAnchor": "itemType",
"type": "string"
}
},
"$ref": "genericList"
}
},
"then": {
"title": "any type of node",
"$id": "anyLeafNode",
"$dynamicAnchor": "foo",
"$ref": "inner"
},
"else": {
"title": "integer node",
"$id": "integerNode",
"$dynamicAnchor": "foo",
"type": [ "object", "integer" ],
"$ref": "inner"
}
},
"tests": [
{
"description": "recurse to anyLeafNode - floats are allowed",
"data": { "alpha": 1.1 },
"description": "number list with number values",
"data": {
"kindOfList": "numbers",
"list": [1.1]
},
"valid": true
},
{
"description": "recurse to integerNode - floats are not allowed",
"data": { "november": 1.1 },
"description": "number list with string values",
"data": {
"kindOfList": "numbers",
"list": ["foo"]
},
"valid": false
},
{
"description": "string list with number values",
"data": {
"kindOfList": "strings",
"list": [1.1]
},
"valid": false
},
{
"description": "string list with string values",
"data": {
"kindOfList": "strings",
"list": ["foo"]
},
"valid": true
}
]
},
Expand Down Expand Up @@ -564,5 +594,23 @@
"valid": false
}
]
},
{
"description": "$ref to $dynamicRef finds detached $dynamicAnchor",
"schema": {
"$ref": "http://localhost:1234/draft-next/detached-dynamicref.json#/$defs/foo"
},
"tests": [
{
"description": "number is valid",
"data": 1,
"valid": true
},
{
"description": "non-number is invalid",
"data": "a",
"valid": false
}
]
}
]
18 changes: 18 additions & 0 deletions json/tests/draft-next/refRemote.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,5 +310,23 @@
"valid": true
}
]
},
{
"description": "$ref to $ref finds detached $anchor",
"schema": {
"$ref": "http://localhost:1234/draft-next/detached-ref.json#/$defs/foo"
},
"tests": [
{
"description": "number is valid",
"data": 1,
"valid": true
},
{
"description": "non-number is invalid",
"data": "a",
"valid": false
}
]
}
]
18 changes: 18 additions & 0 deletions json/tests/draft2019-09/refRemote.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,5 +310,23 @@
"valid": true
}
]
},
{
"description": "$ref to $ref finds detached $anchor",
"schema": {
"$ref": "http://localhost:1234/draft2019-09/detached-ref.json#/$defs/foo"
},
"tests": [
{
"description": "number is valid",
"data": 1,
"valid": true
},
{
"description": "non-number is invalid",
"data": "a",
"valid": false
}
]
}
]
Loading

0 comments on commit 8a55721

Please sign in to comment.