Skip to content

Additional $ref tests for draft-04/06 #160

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 7 commits into from
Mar 17, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
68 changes: 65 additions & 3 deletions tests/draft4/refRemote.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
]
},
{
"description": "change resolution scope",
"description": "base URI change",
"schema": {
"id": "http://localhost:1234/",
"items": {
Expand All @@ -60,15 +60,77 @@
},
"tests": [
{
"description": "changed scope ref valid",
"description": "base URI change ref valid",
"data": [[1]],
"valid": true
},
{
"description": "changed scope ref invalid",
"description": "base URI change ref invalid",
"data": [["a"]],
"valid": false
}
]
},
{
"description": "base URI change - change folder",
"schema": {
"id": "http://localhost:1234/scope_change_defs1.json",
"type" : "object",
"properties": {
"list": {"$ref": "#/definitions/baz"}
},
"definitions": {
"baz": {
"id": "folder/",
"type": "array",
"items": {"$ref": "folderInteger.json"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is folderInteger.json? Maybe I just don't understand this schema or the use of id, I don't know =/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Relequestual there is a convention already used in other tests to assume that schemas at http://localhost:1234/ are files in remotes folder, folderInteger.json is in remotes/folder, its full URI is http://localhost:1234/folder/folderInteger.json (and there is another existing test that points to it).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}
},
"tests": [
{
"description": "number is valid",
"data": {"list": [1]},
"valid": true
},
{
"description": "string is invalid",
"data": {"list": ["a"]},
"valid": false
}
]
},
{
"description": "base URI change - change folder in subschema",
"schema": {
"id": "http://localhost:1234/scope_change_defs2.json",
"type" : "object",
"properties": {
"list": {"$ref": "#/definitions/baz/definitions/bar"}
},
"definitions": {
"baz": {
"id": "folder/",
"definitions": {
"bar": {
"type": "array",
"items": {"$ref": "folderInteger.json"}
}
}
}
}
},
"tests": [
{
"description": "number is valid",
"data": {"list": [1]},
"valid": true
},
{
"description": "string is invalid",
"data": {"list": ["a"]},
"valid": false
}
]
}
]
68 changes: 65 additions & 3 deletions tests/draft6/refRemote.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
]
},
{
"description": "change resolution scope",
"description": "base URI change",
"schema": {
"id": "http://localhost:1234/",
"items": {
Expand All @@ -60,15 +60,77 @@
},
"tests": [
{
"description": "changed scope ref valid",
"description": "base URI change ref valid",
"data": [[1]],
"valid": true
},
{
"description": "changed scope ref invalid",
"description": "base URI change ref invalid",
"data": [["a"]],
"valid": false
}
]
},
{
"description": "base URI change - change folder",
"schema": {
"id": "http://localhost:1234/scope_change_defs1.json",
"type" : "object",
"properties": {
"list": {"$ref": "#/definitions/baz"}
},
"definitions": {
"baz": {
"id": "folder/",
"type": "array",
"items": {"$ref": "folderInteger.json"}
}
}
},
"tests": [
{
"description": "number is valid",
"data": {"list": [1]},
"valid": true
},
{
"description": "string is invalid",
"data": {"list": ["a"]},
"valid": false
}
]
},
{
"description": "base URI change - change folder in subschema",
"schema": {
"id": "http://localhost:1234/scope_change_defs2.json",
"type" : "object",
"properties": {
"list": {"$ref": "#/definitions/baz/definitions/bar"}
},
"definitions": {
"baz": {
"id": "folder/",
"definitions": {
"bar": {
"type": "array",
"items": {"$ref": "folderInteger.json"}
}
}
}
}
},
"tests": [
{
"description": "number is valid",
"data": {"list": [1]},
"valid": true
},
{
"description": "string is invalid",
"data": {"list": ["a"]},
"valid": false
}
]
}
]