Skip to content

Commit c74aadf

Browse files
author
Jake Waffle
committed
Added a test that I previously deleted and fixed it so that it correctly reproduces the problem described in issue #12.
1 parent 298fc58 commit c74aadf

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (c) 2016 Network New Technologies Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.networknt.schema;
18+
19+
import org.junit.Ignore;
20+
import org.junit.Test;
21+
22+
/**
23+
* Created by stevehu on 2016-12-20.
24+
*/
25+
public class SelfRefTest extends BaseJsonSchemaValidatorTest {
26+
@Ignore("This test currently is failing because of a StackOverflow caused by a recursive $ref.")
27+
@Test()
28+
public void testSelfRef() throws Exception {
29+
JsonSchema node = getJsonSchemaFromClasspath("selfRef.json");
30+
System.out.println("node = " + node);
31+
}
32+
}

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)