Skip to content

Commit a27c949

Browse files
Merge pull request #446 from json-schema-org/ether/infinite-loop-detection
Add a test to demonstrate the invalidity of a naive infinite loop detection algorithm
2 parents 14cfcde + 371fcab commit a27c949

10 files changed

+360
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[
2+
{
3+
"description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop",
4+
"schema": {
5+
"$defs": {
6+
"int": { "type": "integer" }
7+
},
8+
"allOf": [
9+
{
10+
"properties": {
11+
"foo": {
12+
"$ref": "#/$defs/int"
13+
}
14+
}
15+
},
16+
{
17+
"additionalProperties": {
18+
"$ref": "#/$defs/int"
19+
}
20+
}
21+
]
22+
},
23+
"tests": [
24+
{
25+
"description": "passing case",
26+
"data": { "foo": 1 },
27+
"valid": true
28+
},
29+
{
30+
"description": "failing case",
31+
"data": { "foo": "a string" },
32+
"valid": false
33+
}
34+
]
35+
}
36+
]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[
2+
{
3+
"description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop",
4+
"schema": {
5+
"$defs": {
6+
"int": { "type": "integer" }
7+
},
8+
"allOf": [
9+
{
10+
"properties": {
11+
"foo": {
12+
"$ref": "#/$defs/int"
13+
}
14+
}
15+
},
16+
{
17+
"additionalProperties": {
18+
"$ref": "#/$defs/int"
19+
}
20+
}
21+
]
22+
},
23+
"tests": [
24+
{
25+
"description": "passing case",
26+
"data": { "foo": 1 },
27+
"valid": true
28+
},
29+
{
30+
"description": "failing case",
31+
"data": { "foo": "a string" },
32+
"valid": false
33+
}
34+
]
35+
}
36+
]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[
2+
{
3+
"description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop",
4+
"schema": {
5+
"definitions": {
6+
"int": { "type": "integer" }
7+
},
8+
"allOf": [
9+
{
10+
"properties": {
11+
"foo": {
12+
"$ref": "#/definitions/int"
13+
}
14+
}
15+
},
16+
{
17+
"additionalProperties": {
18+
"$ref": "#/defintions/int"
19+
}
20+
}
21+
]
22+
},
23+
"tests": [
24+
{
25+
"description": "passing case",
26+
"data": { "foo": 1 },
27+
"valid": true
28+
},
29+
{
30+
"description": "failing case",
31+
"data": { "foo": "a string" },
32+
"valid": false
33+
}
34+
]
35+
}
36+
]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[
2+
{
3+
"description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop",
4+
"schema": {
5+
"definitions": {
6+
"int": { "type": "integer" }
7+
},
8+
"allOf": [
9+
{
10+
"properties": {
11+
"foo": {
12+
"$ref": "#/definitions/int"
13+
}
14+
}
15+
},
16+
{
17+
"additionalProperties": {
18+
"$ref": "#/defintions/int"
19+
}
20+
}
21+
]
22+
},
23+
"tests": [
24+
{
25+
"description": "passing case",
26+
"data": { "foo": 1 },
27+
"valid": true
28+
},
29+
{
30+
"description": "failing case",
31+
"data": { "foo": "a string" },
32+
"valid": false
33+
}
34+
]
35+
}
36+
]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[
2+
{
3+
"description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop",
4+
"schema": {
5+
"definitions": {
6+
"int": { "type": "integer" }
7+
},
8+
"allOf": [
9+
{
10+
"properties": {
11+
"foo": {
12+
"$ref": "#/definitions/int"
13+
}
14+
}
15+
},
16+
{
17+
"additionalProperties": {
18+
"$ref": "#/defintions/int"
19+
}
20+
}
21+
]
22+
},
23+
"tests": [
24+
{
25+
"description": "passing case",
26+
"data": { "foo": 1 },
27+
"valid": true
28+
},
29+
{
30+
"description": "failing case",
31+
"data": { "foo": "a string" },
32+
"valid": false
33+
}
34+
]
35+
}
36+
]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[
2+
{
3+
"description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop",
4+
"schema": {
5+
"definitions": {
6+
"int": { "type": "integer" }
7+
},
8+
"allOf": [
9+
{
10+
"properties": {
11+
"foo": {
12+
"$ref": "#/definitions/int"
13+
}
14+
}
15+
},
16+
{
17+
"additionalProperties": {
18+
"$ref": "#/defintions/int"
19+
}
20+
}
21+
]
22+
},
23+
"tests": [
24+
{
25+
"description": "passing case",
26+
"data": { "foo": 1 },
27+
"valid": true
28+
},
29+
{
30+
"description": "failing case",
31+
"data": { "foo": "a string" },
32+
"valid": false
33+
}
34+
]
35+
}
36+
]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[
2+
{
3+
"description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop",
4+
"schema": {
5+
"definitions": {
6+
"int": { "type": "integer" }
7+
},
8+
"allOf": [
9+
{
10+
"properties": {
11+
"foo": {
12+
"$ref": "#/definitions/int"
13+
}
14+
}
15+
},
16+
{
17+
"additionalProperties": {
18+
"$ref": "#/defintions/int"
19+
}
20+
}
21+
]
22+
},
23+
"tests": [
24+
{
25+
"description": "passing case",
26+
"data": { "foo": 1 },
27+
"valid": true
28+
},
29+
{
30+
"description": "failing case",
31+
"data": { "foo": "a string" },
32+
"valid": false
33+
}
34+
]
35+
}
36+
]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[
2+
{
3+
"description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop",
4+
"schema": {
5+
"definitions": {
6+
"int": { "type": "integer" }
7+
},
8+
"allOf": [
9+
{
10+
"properties": {
11+
"foo": {
12+
"$ref": "#/definitions/int"
13+
}
14+
}
15+
},
16+
{
17+
"additionalProperties": {
18+
"$ref": "#/defintions/int"
19+
}
20+
}
21+
]
22+
},
23+
"tests": [
24+
{
25+
"description": "passing case",
26+
"data": { "foo": 1 },
27+
"valid": true
28+
},
29+
{
30+
"description": "failing case",
31+
"data": { "foo": "a string" },
32+
"valid": false
33+
}
34+
]
35+
}
36+
]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[
2+
{
3+
"description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop",
4+
"schema": {
5+
"definitions": {
6+
"int": { "type": "integer" }
7+
},
8+
"allOf": [
9+
{
10+
"properties": {
11+
"foo": {
12+
"$ref": "#/definitions/int"
13+
}
14+
}
15+
},
16+
{
17+
"additionalProperties": {
18+
"$ref": "#/defintions/int"
19+
}
20+
}
21+
]
22+
},
23+
"tests": [
24+
{
25+
"description": "passing case",
26+
"data": { "foo": 1 },
27+
"valid": true
28+
},
29+
{
30+
"description": "failing case",
31+
"data": { "foo": "a string" },
32+
"valid": false
33+
}
34+
]
35+
}
36+
]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[
2+
{
3+
"description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop",
4+
"schema": {
5+
"definitions": {
6+
"int": { "type": "integer" }
7+
},
8+
"allOf": [
9+
{
10+
"properties": {
11+
"foo": {
12+
"$ref": "#/definitions/int"
13+
}
14+
}
15+
},
16+
{
17+
"additionalProperties": {
18+
"$ref": "#/defintions/int"
19+
}
20+
}
21+
]
22+
},
23+
"tests": [
24+
{
25+
"description": "passing case",
26+
"data": { "foo": 1 },
27+
"valid": true
28+
},
29+
{
30+
"description": "failing case",
31+
"data": { "foo": "a string" },
32+
"valid": false
33+
}
34+
]
35+
}
36+
]

0 commit comments

Comments
 (0)