Skip to content

Commit 7ed7f50

Browse files
committed
When $ref is present other keywords should be ignored
1 parent f3d5aeb commit 7ed7f50

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

tests/draft3/ref.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,34 @@
140140
}
141141
]
142142
},
143+
{
144+
"description": "ref, containing other keywords",
145+
"schema": {
146+
"definitions": {
147+
"reffed": {
148+
"type": "array"
149+
}
150+
},
151+
"properties": {
152+
"foo": {
153+
"$ref": "#/definitions/reffed",
154+
"maxItems": 2
155+
}
156+
}
157+
},
158+
"tests": [
159+
{
160+
"description": "remote ref valid",
161+
"data": { "foo": [] },
162+
"valid": true
163+
},
164+
{
165+
"description": "remote ref valid, maxItems ignored",
166+
"data": { "foo": [ 1, 2, 3] },
167+
"valid": true
168+
}
169+
]
170+
},
143171
{
144172
"description": "remote ref, containing refs itself",
145173
"schema": {"$ref": "http://json-schema.org/draft-03/schema#"},

tests/draft4/ref.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,34 @@
140140
}
141141
]
142142
},
143+
{
144+
"description": "ref, containing other keywords",
145+
"schema": {
146+
"definitions": {
147+
"reffed": {
148+
"type": "array"
149+
}
150+
},
151+
"properties": {
152+
"foo": {
153+
"$ref": "#/definitions/reffed",
154+
"maxItems": 2
155+
}
156+
}
157+
},
158+
"tests": [
159+
{
160+
"description": "remote ref valid",
161+
"data": { "foo": [] },
162+
"valid": true
163+
},
164+
{
165+
"description": "remote ref valid, maxItems ignored",
166+
"data": { "foo": [ 1, 2, 3] },
167+
"valid": true
168+
}
169+
]
170+
},
143171
{
144172
"description": "remote ref, containing refs itself",
145173
"schema": {"$ref": "http://json-schema.org/draft-04/schema#"},

0 commit comments

Comments
 (0)