Skip to content

When $ref is present other keywords should be ignored #142

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
Dec 26, 2016
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
33 changes: 33 additions & 0 deletions tests/draft3/ref.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,39 @@
}
]
},
{
"description": "ref overrides any sibling keywords",
"schema": {
"definitions": {
"reffed": {
"type": "array"
}
},
"properties": {
"foo": {
"$ref": "#/definitions/reffed",
"maxItems": 2
}
}
},
"tests": [
{
"description": "remote ref valid",
"data": { "foo": [] },
"valid": true
},
{
"description": "remote ref valid, maxItems ignored",
"data": { "foo": [ 1, 2, 3] },
"valid": true
},
{
"description": "ref invalid",
"data": { "foo": "string" },
"valid": false
}
]
},
{
"description": "remote ref, containing refs itself",
"schema": {"$ref": "http://json-schema.org/draft-03/schema#"},
Expand Down
33 changes: 33 additions & 0 deletions tests/draft4/ref.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,39 @@
}
]
},
{
"description": "ref overrides any sibling keywords",
"schema": {
"definitions": {
"reffed": {
"type": "array"
}
},
"properties": {
"foo": {
"$ref": "#/definitions/reffed",
"maxItems": 2
}
}
},
"tests": [
{
"description": "ref valid",
"data": { "foo": [] },
"valid": true
},
{
"description": "ref valid, maxItems ignored",
"data": { "foo": [ 1, 2, 3] },
"valid": true
},
{
"description": "ref invalid",
"data": { "foo": "string" },
"valid": false
}
]
},
{
"description": "remote ref, containing refs itself",
"schema": {"$ref": "http://json-schema.org/draft-04/schema#"},
Expand Down