Skip to content

Commit 3186761

Browse files
committed
draft-04/06: root ref "#" in remote ref
1 parent 0178c74 commit 3186761

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

remotes/name.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"definitions": {
3+
"orNull": {
4+
"anyOf": [
5+
{"type": "null"},
6+
{"$ref": "#"}
7+
]
8+
}
9+
},
10+
"type": "string"
11+
}

tests/draft4/refRemote.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,40 @@
132132
"valid": false
133133
}
134134
]
135+
},
136+
{
137+
"description": "root ref in remote ref",
138+
"schema": {
139+
"id": "http://localhost:1234/object",
140+
"type": "object",
141+
"properties": {
142+
"name": {"$ref": "name.json#/definitions/orNull"}
143+
}
144+
},
145+
"tests": [
146+
{
147+
"description": "string is valid",
148+
"data": {
149+
"name": "foo"
150+
},
151+
"valid": true
152+
},
153+
{
154+
"description": "null is valid",
155+
"data": {
156+
"name": null
157+
},
158+
"valid": true
159+
},
160+
{
161+
"description": "object is invalid",
162+
"data": {
163+
"name": {
164+
"name": null
165+
}
166+
},
167+
"valid": false
168+
}
169+
]
135170
}
136171
]

tests/draft6/refRemote.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,40 @@
132132
"valid": false
133133
}
134134
]
135+
},
136+
{
137+
"description": "root ref in remote ref",
138+
"schema": {
139+
"id": "http://localhost:1234/object",
140+
"type": "object",
141+
"properties": {
142+
"name": {"$ref": "name.json#/definitions/orNull"}
143+
}
144+
},
145+
"tests": [
146+
{
147+
"description": "string is valid",
148+
"data": {
149+
"name": "foo"
150+
},
151+
"valid": true
152+
},
153+
{
154+
"description": "null is valid",
155+
"data": {
156+
"name": null
157+
},
158+
"valid": true
159+
},
160+
{
161+
"description": "object is invalid",
162+
"data": {
163+
"name": {
164+
"name": null
165+
}
166+
},
167+
"valid": false
168+
}
169+
]
135170
}
136171
]

0 commit comments

Comments
 (0)