Skip to content

Commit 98d3fba

Browse files
committed
add a test case for self ref
1 parent 6bef6c8 commit 98d3fba

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.networknt.schema;
2+
3+
import com.fasterxml.jackson.databind.JsonNode;
4+
import org.junit.Test;
5+
6+
/**
7+
* Created by stevehu on 2016-12-20.
8+
*/
9+
public class SelfRefTest extends BaseJsonSchemaValidatorTest {
10+
@Test
11+
public void testSelfRef() throws Exception {
12+
JsonNode node = getJsonNodeFromClasspath("selfref.json");
13+
System.out.println("node = " + node);
14+
}
15+
}

src/test/resources/selfref.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"type": "object",
3+
"properties": {
4+
"name": {
5+
"type": "string"
6+
},
7+
"tree": {
8+
"$ref": "#/definitions/tree"
9+
}
10+
},
11+
"definitions": {
12+
"tree": {
13+
"type": "object",
14+
"properties": {
15+
"value": {
16+
"type": "string"
17+
},
18+
"branches": {
19+
"type": "array",
20+
"items": {
21+
"$ref": "#/definitions/tree"
22+
},
23+
"minItems": 1
24+
}
25+
},
26+
"required": [
27+
"value"
28+
]
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)