Skip to content

Commit f435fc9

Browse files
committed
Add tests combining remote refs and defs
1 parent a574158 commit f435fc9

File tree

6 files changed

+114
-0
lines changed

6 files changed

+114
-0
lines changed

remotes/ref-and-definitions.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$id": "ref-and-definitions.json",
3+
"definitions": {
4+
"inner": {
5+
"properties": {
6+
"bar": { "type": "string" }
7+
}
8+
}
9+
},
10+
"$ref": "#/definitions/inner"
11+
}

remotes/ref-and-defs.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$id": "ref-and-defs.json",
3+
"$defs": {
4+
"inner": {
5+
"properties": {
6+
"bar": { "type": "string" }
7+
}
8+
}
9+
},
10+
"$ref": "#/$defs/inner"
11+
}

tests/draft2019-09/refRemote.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,5 +163,28 @@
163163
"valid": false
164164
}
165165
]
166+
},
167+
{
168+
"description": "remote ref with ref to defs",
169+
"schema": {
170+
"$id": "http://localhost:1234/schema1.json",
171+
"$ref": "ref-and-defs.json"
172+
},
173+
"tests": [
174+
{
175+
"description": "invalid",
176+
"data": {
177+
"bar": 1
178+
},
179+
"valid": false
180+
},
181+
{
182+
"description": "valid",
183+
"data": {
184+
"bar": "a"
185+
},
186+
"valid": true
187+
}
188+
]
166189
}
167190
]

tests/draft2020-12/refRemote.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,5 +163,28 @@
163163
"valid": false
164164
}
165165
]
166+
},
167+
{
168+
"description": "remote ref with ref to defs",
169+
"schema": {
170+
"$id": "http://localhost:1234/schema1.json",
171+
"$ref": "ref-and-defs.json"
172+
},
173+
"tests": [
174+
{
175+
"description": "invalid",
176+
"data": {
177+
"bar": 1
178+
},
179+
"valid": false
180+
},
181+
{
182+
"description": "valid",
183+
"data": {
184+
"bar": "a"
185+
},
186+
"valid": true
187+
}
188+
]
166189
}
167190
]

tests/draft6/refRemote.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,28 @@
167167
"valid": false
168168
}
169169
]
170+
},
171+
{
172+
"description": "remote ref with ref to definitions",
173+
"schema": {
174+
"$id": "http://localhost:1234/schema1.json",
175+
"$ref": "ref-and-definitions.json"
176+
},
177+
"tests": [
178+
{
179+
"description": "invalid",
180+
"data": {
181+
"bar": 1
182+
},
183+
"valid": false
184+
},
185+
{
186+
"description": "valid",
187+
"data": {
188+
"bar": "a"
189+
},
190+
"valid": true
191+
}
192+
]
170193
}
171194
]

tests/draft7/refRemote.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,28 @@
167167
"valid": false
168168
}
169169
]
170+
},
171+
{
172+
"description": "remote ref with ref to definitions",
173+
"schema": {
174+
"$id": "http://localhost:1234/schema1.json",
175+
"$ref": "ref-and-definitions.json"
176+
},
177+
"tests": [
178+
{
179+
"description": "invalid",
180+
"data": {
181+
"bar": 1
182+
},
183+
"valid": false
184+
},
185+
{
186+
"description": "valid",
187+
"data": {
188+
"bar": "a"
189+
},
190+
"valid": true
191+
}
192+
]
170193
}
171194
]

0 commit comments

Comments
 (0)