Skip to content

Commit 3d5048e

Browse files
authored
Merge pull request #733 from Era-cell/main
Tests for propertyNames with additionalProperties/unevaluatedProperties
2 parents 57617f2 + 2480edb commit 3d5048e

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

tests/draft-next/additionalProperties.json

+24
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,29 @@
152152
"valid": true
153153
}
154154
]
155+
},
156+
{
157+
"description": "additionalProperties with propertyNames",
158+
"schema": {
159+
"$schema": "https://json-schema.org/draft/next/schema",
160+
"propertyNames": {
161+
"maxLength": 5
162+
},
163+
"additionalProperties": {
164+
"type": "number"
165+
}
166+
},
167+
"tests": [
168+
{
169+
"description": "Valid against both keywords",
170+
"data": { "apple": 4 },
171+
"valid": true
172+
},
173+
{
174+
"description": "Valid against propertyNames, but not unevaluatedProperties",
175+
"data": { "fig": 2, "pear": "available" },
176+
"valid": false
177+
}
178+
]
155179
}
156180
]

tests/draft2019-09/additionalProperties.json

+24
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,29 @@
152152
"valid": true
153153
}
154154
]
155+
},
156+
{
157+
"description": "additionalProperties with propertyNames",
158+
"schema": {
159+
"$schema": "https://json-schema.org/draft/next/schema",
160+
"propertyNames": {
161+
"maxLength": 5
162+
},
163+
"additionalProperties": {
164+
"type": "number"
165+
}
166+
},
167+
"tests": [
168+
{
169+
"description": "Valid against both keywords",
170+
"data": { "apple": 4 },
171+
"valid": true
172+
},
173+
{
174+
"description": "Valid against propertyNames, but not unevaluatedProperties",
175+
"data": { "fig": 2, "pear": "available" },
176+
"valid": false
177+
}
178+
]
155179
}
156180
]

tests/draft2020-12/additionalProperties.json

+24
Original file line numberDiff line numberDiff line change
@@ -158,5 +158,29 @@
158158
"valid": true
159159
}
160160
]
161+
},
162+
{
163+
"description": "additionalProperties with propertyNames",
164+
"schema": {
165+
"$schema": "https://json-schema.org/draft/2020-12/schema",
166+
"propertyNames": {
167+
"maxLength": 5
168+
},
169+
"additionalProperties": {
170+
"type": "number"
171+
}
172+
},
173+
"tests": [
174+
{
175+
"description": "Valid against both keywords",
176+
"data": { "apple": 4 },
177+
"valid": true
178+
},
179+
{
180+
"description": "Valid against propertyNames, but not unevaluatedProperties",
181+
"data": { "fig": 2, "pear": "available" },
182+
"valid": false
183+
}
184+
]
161185
}
162186
]

0 commit comments

Comments
 (0)