Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions tests/draft2019-09/ref.json
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,39 @@
}
]
},
{
"description": "order of evaluation: $id and $ref on nested schema",
"schema": {
"$comment": "$id must be evaluated before $ref to get the proper $ref destination",
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "https://example.com/draft2019-09/ref-and-id3/base.json",
"$ref": "nested/foo.json",
"$defs": {
"foo": {
"$comment": "canonical uri: https://example.com/draft2019-09/ref-and-id3/nested/foo.json",
"$id": "nested/foo.json",
"$ref": "./bar.json"
},
"bar": {
"$comment": "canonical uri: https://example.com/draft2019-09/ref-and-id3/nested/bar.json",
"$id": "nested/bar.json",
"type": "number"
}
}
},
"tests": [
{
"description": "data is valid against nested sibling",
"data": 5,
"valid": true
},
{
"description": "data is invalid against nested sibling",
"data": "a",
"valid": false
}
]
},
{
"description": "simple URN base URI with $ref via the URN",
"schema": {
Expand Down
33 changes: 33 additions & 0 deletions tests/draft2020-12/ref.json
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,39 @@
}
]
},
{
"description": "order of evaluation: $id and $ref on nested schema",
"schema": {
"$comment": "$id must be evaluated before $ref to get the proper $ref destination",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/draft2020-12/ref-and-id3/base.json",
"$ref": "nested/foo.json",
"$defs": {
"foo": {
"$comment": "canonical uri: https://example.com/draft2020-12/ref-and-id3/nested/foo.json",
"$id": "nested/foo.json",
"$ref": "./bar.json"
},
"bar": {
"$comment": "canonical uri: https://example.com/draft2020-12/ref-and-id3/nested/bar.json",
"$id": "nested/bar.json",
"type": "number"
}
}
},
"tests": [
{
"description": "data is valid against nested sibling",
"data": 5,
"valid": true
},
{
"description": "data is invalid against nested sibling",
"data": "a",
"valid": false
}
]
},
{
"description": "simple URN base URI with $ref via the URN",
"schema": {
Expand Down
33 changes: 33 additions & 0 deletions tests/v1/ref.json
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,39 @@
}
]
},
{
"description": "order of evaluation: $id and $ref on nested schema",
"schema": {
"$comment": "$id must be evaluated before $ref to get the proper $ref destination",
"$schema": "https://json-schema.org/v1",
"$id": "https://example.com/v1/ref-and-id3/base.json",
"$ref": "nested/foo.json",
"$defs": {
"foo": {
"$comment": "canonical uri: https://example.com/v1/ref-and-id3/nested/foo.json",
"$id": "nested/foo.json",
"$ref": "./bar.json"
},
"bar": {
"$comment": "canonical uri: https://example.com/v1/ref-and-id3/nested/bar.json",
"$id": "nested/bar.json",
"type": "number"
}
}
},
"tests": [
{
"description": "data is valid against nested sibling",
"data": 5,
"valid": true
},
{
"description": "data is invalid against nested sibling",
"data": "a",
"valid": false
}
]
},
{
"description": "simple URN base URI with $ref via the URN",
"schema": {
Expand Down
Loading