Skip to content

Commit f5bd2f6

Browse files
Merge pull request #632 from json-schema-org/ether/annotations-inside-not
test that annations are collected inside a "not"
2 parents f57d3e0 + 626b433 commit f5bd2f6

File tree

3 files changed

+81
-3
lines changed

3 files changed

+81
-3
lines changed

tests/draft-next/not.json

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,31 @@
123123
"valid": true
124124
}
125125
]
126-
}
126+
},
127+
{
128+
"description": "collect annotations inside a 'not', even if collection is disabled",
129+
"schema": {
130+
"$schema": "https://json-schema.org/draft/next/schema",
131+
"not": {
132+
"$comment": "this subschema must still produce annotations internally, even though the 'not' will ultimately discard them",
133+
"anyOf": [
134+
true,
135+
{ "properties": { "foo": true } }
136+
],
137+
"unevaluatedProperties": false
138+
}
139+
},
140+
"tests": [
141+
{
142+
"description": "no properties to evaluate",
143+
"data": {},
144+
"valid": true
145+
},
146+
{
147+
"description": "annotations are still collected inside a 'not'",
148+
"data": { "foo": 1 },
149+
"valid": false
150+
}
151+
]
152+
}
127153
]

tests/draft2019-09/not.json

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,31 @@
123123
"valid": true
124124
}
125125
]
126-
}
126+
},
127+
{
128+
"description": "collect annotations inside a 'not', even if collection is disabled",
129+
"schema": {
130+
"$schema": "https://json-schema.org/draft/2019-09/schema",
131+
"not": {
132+
"$comment": "this subschema must still produce annotations internally, even though the 'not' will ultimately discard them",
133+
"anyOf": [
134+
true,
135+
{ "properties": { "foo": true } }
136+
],
137+
"unevaluatedProperties": false
138+
}
139+
},
140+
"tests": [
141+
{
142+
"description": "no properties to evaluate",
143+
"data": {},
144+
"valid": true
145+
},
146+
{
147+
"description": "annotations are still collected inside a 'not'",
148+
"data": { "foo": 1 },
149+
"valid": false
150+
}
151+
]
152+
}
127153
]

tests/draft2020-12/not.json

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,31 @@
123123
"valid": true
124124
}
125125
]
126-
}
126+
},
127+
{
128+
"description": "collect annotations inside a 'not', even if collection is disabled",
129+
"schema": {
130+
"$schema": "https://json-schema.org/draft/2020-12/schema",
131+
"not": {
132+
"$comment": "this subschema must still produce annotations internally, even though the 'not' will ultimately discard them",
133+
"anyOf": [
134+
true,
135+
{ "properties": { "foo": true } }
136+
],
137+
"unevaluatedProperties": false
138+
}
139+
},
140+
"tests": [
141+
{
142+
"description": "no properties to evaluate",
143+
"data": {},
144+
"valid": true
145+
},
146+
{
147+
"description": "annotations are still collected inside a 'not'",
148+
"data": { "foo": 1 },
149+
"valid": false
150+
}
151+
]
152+
}
127153
]

0 commit comments

Comments
 (0)