Skip to content

Commit ce1d5c8

Browse files
authored
Merge pull request #29 from eskabetxe/features/idSchemaWithUrl
Features/id schema with url
2 parents 0958e50 + 713f1a6 commit ce1d5c8

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

src/test/java/com/networknt/schema/JsonSchemaTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,5 +259,10 @@ public void testTypeValidator() throws Exception {
259259
public void testUniqueItemsValidator() throws Exception {
260260
runTestFile("tests/uniqueItems.json");
261261
}
262+
263+
@Test
264+
public void testIdSchemaWithUrl() throws Exception {
265+
runTestFile("tests/id_schema/property.json");
266+
}
262267

263268
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[
2+
{
3+
"description": "id as schema",
4+
"schema": {
5+
"id": "http://localhost:1234/id_schema/schema/features.json",
6+
"title": "property object",
7+
"type": "object",
8+
"properties": {
9+
"featuresInteger": {
10+
"$ref": "#/featuresInteger"
11+
},
12+
"featuresBoolean": {
13+
"$ref": "#/featuresBoolean"
14+
}
15+
},
16+
"additionalProperties": false
17+
},
18+
"tests": [
19+
{
20+
"data": {
21+
"featuresInteger": 4,
22+
"featuresBoolean": true
23+
},
24+
"valid": true
25+
},
26+
{
27+
"data": {
28+
"featuresInteger": 4.0,
29+
"featuresBoolean": true
30+
},
31+
"valid": false
32+
}
33+
]
34+
}
35+
]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"title": "features fields",
4+
"featuresBoolean": {
5+
"title": "boolean feature",
6+
"type": "boolean"
7+
},
8+
"featuresInteger": {
9+
"title": "integer feature",
10+
"type": "integer",
11+
"minimum": 1,
12+
"maximum": 99999
13+
}
14+
}

0 commit comments

Comments
 (0)