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 25, 2020
1 parent d17e1ba commit ceceb51
Showing 1 changed file with 158 additions and 2 deletions.
160 changes: 158 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,162 @@
}
]
},
{
"description": "Location-independent identifier name, fragments disallowed",
"schema": {
"$ref": "#foo",
"$defs": {
"A": {
"$id": "#foo",
"type": "integer"
}
}
},
"tests": [
{
"data": 1,
"description": "match",
"valid": false
},
{
"data": "a",
"description": "mismatch",
"valid": false
}
]
},
{
"description": "Location-independent identifier path, fragments disallowed",
"schema": {
"$ref": "#/a/b",
"$defs": {
"A": {
"$id": "#/a/b",
"type": "integer"
}
}
},
"tests": [
{
"data": 1,
"description": "match",
"valid": false
},
{
"data": "a",
"description": "mismatch",
"valid": false
}
]
},
{
"description": "Location-independent identifier name with absolute URI, fragments disallowed",
"schema": {
"$ref": "http://localhost:1234/bar#foo",
"$defs": {
"A": {
"$id": "http://localhost:1234/bar#foo",
"type": "integer"
}
}
},
"tests": [
{
"data": 1,
"description": "match",
"valid": false
},
{
"data": "a",
"description": "mismatch",
"valid": false
}
]
},
{
"description": "Location-independent identifier path with absolute URI, fragments disallowed",
"schema": {
"$ref": "http://localhost:1234/bar#/a/b",
"$defs": {
"A": {
"$id": "http://localhost:1234/bar#/a/b",
"type": "integer"
}
}
},
"tests": [
{
"data": 1,
"description": "match",
"valid": false
},
{
"data": "a",
"description": "mismatch",
"valid": false
}
]
},
{
"description": "Location-independent identifier name with base URI change in subschema, fragments disallowed",
"schema": {
"$id": "http://localhost:1234/root",
"$ref": "http://localhost:1234/nested.json#foo",
"$defs": {
"A": {
"$id": "nested.json",
"$defs": {
"B": {
"$id": "#foo",
"type": "integer"
}
}
}
}
},
"tests": [
{
"data": 1,
"description": "match",
"valid": false
},
{
"data": "a",
"description": "mismatch",
"valid": false
}
]
},
{
"description": "Location-independent identifier path with base URI change in subschema, fragments disallowed",
"schema": {
"$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"
}
}
}
}
},
"tests": [
{
"data": 1,
"description": "match",
"valid": false
},
{
"data": "a",
"description": "mismatch",
"valid": false
}
]
},
{
"description": "ref creates new scope when adjacent to keywords",
"schema": {
Expand Down

0 comments on commit ceceb51

Please sign in to comment.