Skip to content

Add tests for some more differing URI scenarios. #594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2022
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
5 changes: 5 additions & 0 deletions remotes/different-id-ref-string.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$id": "http://localhost:1234/real-id-ref-string.json",
"$defs": {"bar": {"type": "string"}},
"$ref": "#/$defs/bar"
}
9 changes: 9 additions & 0 deletions remotes/nested-absolute-ref-to-string.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$defs": {
"bar": {
"$id": "http://localhost:1234/the-nested-id.json",
"type": "string"
}
},
"$ref": "http://localhost:1234/the-nested-id.json"
}
5 changes: 5 additions & 0 deletions remotes/urn-ref-string.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$id": "urn:uuid:feebdaed-ffff-0000-ffff-0000deadbeef",
"$defs": {"bar": {"type": "string"}},
"$ref": "#/$defs/bar"
}
25 changes: 25 additions & 0 deletions tests/draft-next/ref.json
Original file line number Diff line number Diff line change
Expand Up @@ -830,5 +830,30 @@
"valid": false
}
]
},
{
"description": "URN ref with nested pointer ref",
"schema": {
"$ref": "urn:uuid:deadbeef-4321-ffff-ffff-1234feebdaed",
"$defs": {
"foo": {
"$id": "urn:uuid:deadbeef-4321-ffff-ffff-1234feebdaed",
"$defs": {"bar": {"type": "string"}},
"$ref": "#/$defs/bar"
}
}
},
"tests": [
{
"description": "a string is valid",
"data": "bar",
"valid": true
},
{
"description": "a non-string is invalid",
"data": 12,
"valid": false
}
]
}
]
48 changes: 48 additions & 0 deletions tests/draft-next/refRemote.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,5 +229,53 @@
"valid": true
}
]
},
{
"description": "remote HTTP ref with different $id",
"schema": {"$ref": "http://localhost:1234/different-id-ref-string.json"},
"tests": [
{
"description": "number is invalid",
"data": 1,
"valid": false
},
{
"description": "string is valid",
"data": "foo",
"valid": true
}
]
},
{
"description": "remote HTTP ref with different URN $id",
"schema": {"$ref": "http://localhost:1234/urn-ref-string.json"},
"tests": [
{
"description": "number is invalid",
"data": 1,
"valid": false
},
{
"description": "string is valid",
"data": "foo",
"valid": true
}
]
},
{
"description": "remote HTTP ref with nested absolute ref",
"schema": {"$ref": "http://localhost:1234/nested-absolute-ref-to-string.json"},
"tests": [
{
"description": "number is invalid",
"data": 1,
"valid": false
},
{
"description": "string is valid",
"data": "foo",
"valid": true
}
]
}
]
25 changes: 25 additions & 0 deletions tests/draft2019-09/ref.json
Original file line number Diff line number Diff line change
Expand Up @@ -830,5 +830,30 @@
"valid": false
}
]
},
{
"description": "URN ref with nested pointer ref",
"schema": {
"$ref": "urn:uuid:deadbeef-4321-ffff-ffff-1234feebdaed",
"$defs": {
"foo": {
"$id": "urn:uuid:deadbeef-4321-ffff-ffff-1234feebdaed",
"$defs": {"bar": {"type": "string"}},
"$ref": "#/$defs/bar"
}
}
},
"tests": [
{
"description": "a string is valid",
"data": "bar",
"valid": true
},
{
"description": "a non-string is invalid",
"data": 12,
"valid": false
}
]
}
]
48 changes: 48 additions & 0 deletions tests/draft2019-09/refRemote.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,5 +229,53 @@
"valid": true
}
]
},
{
"description": "remote HTTP ref with different $id",
"schema": {"$ref": "http://localhost:1234/different-id-ref-string.json"},
"tests": [
{
"description": "number is invalid",
"data": 1,
"valid": false
},
{
"description": "string is valid",
"data": "foo",
"valid": true
}
]
},
{
"description": "remote HTTP ref with different URN $id",
"schema": {"$ref": "http://localhost:1234/urn-ref-string.json"},
"tests": [
{
"description": "number is invalid",
"data": 1,
"valid": false
},
{
"description": "string is valid",
"data": "foo",
"valid": true
}
]
},
{
"description": "remote HTTP ref with nested absolute ref",
"schema": {"$ref": "http://localhost:1234/nested-absolute-ref-to-string.json"},
"tests": [
{
"description": "number is invalid",
"data": 1,
"valid": false
},
{
"description": "string is valid",
"data": "foo",
"valid": true
}
]
}
]
25 changes: 25 additions & 0 deletions tests/draft2020-12/ref.json
Original file line number Diff line number Diff line change
Expand Up @@ -830,5 +830,30 @@
"valid": false
}
]
},
{
"description": "URN ref with nested pointer ref",
"schema": {
"$ref": "urn:uuid:deadbeef-4321-ffff-ffff-1234feebdaed",
"$defs": {
"foo": {
"$id": "urn:uuid:deadbeef-4321-ffff-ffff-1234feebdaed",
"$defs": {"bar": {"type": "string"}},
"$ref": "#/$defs/bar"
}
}
},
"tests": [
{
"description": "a string is valid",
"data": "bar",
"valid": true
},
{
"description": "a non-string is invalid",
"data": 12,
"valid": false
}
]
}
]
48 changes: 48 additions & 0 deletions tests/draft2020-12/refRemote.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,5 +229,53 @@
"valid": true
}
]
},
{
"description": "remote HTTP ref with different $id",
"schema": {"$ref": "http://localhost:1234/different-id-ref-string.json"},
"tests": [
{
"description": "number is invalid",
"data": 1,
"valid": false
},
{
"description": "string is valid",
"data": "foo",
"valid": true
}
]
},
{
"description": "remote HTTP ref with different URN $id",
"schema": {"$ref": "http://localhost:1234/urn-ref-string.json"},
"tests": [
{
"description": "number is invalid",
"data": 1,
"valid": false
},
{
"description": "string is valid",
"data": "foo",
"valid": true
}
]
},
{
"description": "remote HTTP ref with nested absolute ref",
"schema": {"$ref": "http://localhost:1234/nested-absolute-ref-to-string.json"},
"tests": [
{
"description": "number is invalid",
"data": 1,
"valid": false
},
{
"description": "string is valid",
"data": "foo",
"valid": true
}
]
}
]