Skip to content

Add tests for location-independent identifiers in remote ref #454

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

Closed
wants to merge 2 commits into from
Closed
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
13 changes: 12 additions & 1 deletion bin/jsonschema_suite
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ REMOTES = {
"baseUriChange/folderInteger.json": {u"type": u"integer"},
"baseUriChangeFolder/folderInteger.json": {u"type": u"integer"},
"baseUriChangeFolderInSubschema/folderInteger.json": {u"type": u"integer"},
"locationIndependentIdentifier.json": {
"definitions": {
"refToInteger": {
"$ref": "#foo"
},
"A": {
"id": "#foo",
"type": "integer"
}
}
}
}
REMOTES_DIR = os.path.join(ROOT_DIR, "remotes")

Expand Down Expand Up @@ -164,7 +175,7 @@ class SanityTests(unittest.TestCase):
path
for path, contents in expected.items()
if path in files
and contents != files[path]
and contents != files[path]
}

self.assertEqual(
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const refs = {
'http://localhost:1234/baseUriChangeFolder/folderInteger.json': require('./remotes/baseUriChange/folderInteger.json'),
'http://localhost:1234/baseUriChangeFolderInSubschema/folderInteger.json': require('./remotes/baseUriChange/folderInteger.json'),
'http://localhost:1234/name.json': require('./remotes/name.json'),
'http://localhost:1234/name-defs.json': require('./remotes/name-defs.json')
'http://localhost:1234/name-defs.json': require('./remotes/name-defs.json'),
'http://localhost:1234/locationIndependentIdentifier.json': require('./remotes/locationIndependentIdentifier.json')
};

const SKIP = {
Expand Down
11 changes: 11 additions & 0 deletions remotes/locationIndependentIdentifier.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"definitions": {
"refToInteger": {
"$ref": "#foo"
},
"A": {
"id": "#foo",
"type": "integer"
}
}
}
18 changes: 18 additions & 0 deletions tests/draft2019-09/refRemote.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,23 @@
"valid": false
}
]
},
{
"description": "Location-independent identifier in remote ref",
"schema": {
"$ref": "http://localhost:1234/locationIndependentIdentifier.json#/definitions/refToInteger"
},
"tests": [
{
"description": "integer is valid",
"data": 1,
"valid": true
},
{
"description": "string is invalid",
"data": "foo",
"valid": false
}
]
}
]
18 changes: 18 additions & 0 deletions tests/draft4/refRemote.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,23 @@
"valid": false
}
]
},
{
"description": "Location-independent identifier in remote ref",
"schema": {
"$ref": "http://localhost:1234/locationIndependentIdentifier.json#/definitions/refToInteger"
},
"tests": [
{
"description": "integer is valid",
"data": 1,
"valid": true
},
{
"description": "string is invalid",
"data": "foo",
"valid": false
}
]
}
]
18 changes: 18 additions & 0 deletions tests/draft6/refRemote.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,23 @@
"valid": false
}
]
},
{
"description": "Location-independent identifier in remote ref",
"schema": {
"$ref": "http://localhost:1234/locationIndependentIdentifier.json#/definitions/refToInteger"
},
"tests": [
{
"description": "integer is valid",
"data": 1,
"valid": true
},
{
"description": "string is invalid",
"data": "foo",
"valid": false
}
]
}
]
18 changes: 18 additions & 0 deletions tests/draft7/refRemote.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,23 @@
"valid": false
}
]
},
{
"description": "Location-independent identifier in remote ref",
"schema": {
"$ref": "http://localhost:1234/locationIndependentIdentifier.json#/definitions/refToInteger"
},
"tests": [
{
"description": "integer is valid",
"data": 1,
"valid": true
},
{
"description": "string is invalid",
"data": "foo",
"valid": false
}
]
}
]