Skip to content

Commit

Permalink
[299] Add tests for invalid use of fragments in "$id"
Browse files Browse the repository at this point in the history
  • Loading branch information
ssilverman committed Apr 29, 2020
1 parent 2576db4 commit c042465
Showing 1 changed file with 98 additions and 2 deletions.
100 changes: 98 additions & 2 deletions tests/draft2019-09/ref.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
"tests": [
{
"description": "valid tree",
"data": {
"data": {
"meta": "root",
"nodes": [
{
Expand Down Expand Up @@ -302,7 +302,7 @@
},
{
"description": "invalid tree",
"data": {
"data": {
"meta": "root",
"nodes": [
{
Expand Down Expand Up @@ -358,6 +358,102 @@
}
]
},
{
"description": "Invalid use of fragments in location-independent $id",
"schema": {"$ref": "https://json-schema.org/draft/2019-09/schema"},
"tests": [
{
"description": "Identifier name",
"data": {
"$ref": "#foo",
"$defs": {
"A": {
"$id": "#foo",
"type": "integer"
}
}
},
"valid": false
},
{
"description": "Identifier path",
"data": {
"$ref": "#/a/b",
"$defs": {
"A": {
"$id": "#/a/b",
"type": "integer"
}
}
},
"valid": false
},
{
"description": "Identifier name with absolute URI",
"data": {
"$ref": "http://localhost:1234/bar#foo",
"$defs": {
"A": {
"$id": "http://localhost:1234/bar#foo",
"type": "integer"
}
}
},
"valid": false
},
{
"description": "Identifier path with absolute URI",
"data": {
"$ref": "http://localhost:1234/bar#/a/b",
"$defs": {
"A": {
"$id": "http://localhost:1234/bar#/a/b",
"type": "integer"
}
}
},
"valid": false
},
{
"description": "Identifier name with base URI change in subschema",
"data": {
"$id": "http://localhost:1234/root",
"$ref": "http://localhost:1234/nested.json#foo",
"$defs": {
"A": {
"$id": "nested.json",
"$defs": {
"B": {
"$id": "#foo",
"type": "integer"
}
}
}
}
},
"valid": false
},
{
"description": "Identifier path with base URI change in subschema",
"data": {
"$id": "http://localhost:1234/root",
"$ref": "http://localhost:1234/nested.json#/a/b",
"$defs": {
"A": {
"$id": "nested.json",
"$defs": {
"B": {
"$id": "#/a/b",
"type": "integer"
}
}
}
}
},
"valid": false
}
]
},
{
"description": "ref creates new scope when adjacent to keywords",
"schema": {
Expand Down

0 comments on commit c042465

Please sign in to comment.