Skip to content

Commit 964efb8

Browse files
committed
propertyNames doesn't affect additionalProperties, tests exist already for unevaluatedProps
1 parent f08b884 commit 964efb8

File tree

3 files changed

+48
-30
lines changed

3 files changed

+48
-30
lines changed

tests/draft-next/additionalProperties.json

Lines changed: 24 additions & 0 deletions
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

Lines changed: 24 additions & 0 deletions
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/unevaluatedProperties.json

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,35 +1564,5 @@
15641564
"valid": false
15651565
}
15661566
]
1567-
},
1568-
{
1569-
"description": "unevaluatedProperties with propertyNames",
1570-
"schema": {
1571-
"$schema": "https://json-schema.org/draft/2020-12/schema",
1572-
"properties":{
1573-
"banana":{
1574-
"const": "available"
1575-
}
1576-
},
1577-
"propertyNames": {
1578-
"pattern": "^[a-b]"
1579-
},
1580-
"unevaluatedProperties":{
1581-
"type": "number"
1582-
}
1583-
1584-
},
1585-
"tests": [
1586-
{
1587-
"description": "Valid against all constraints",
1588-
"data": { "banana": "available", "apple": 4 },
1589-
"valid": true
1590-
},
1591-
{
1592-
"description": "valid against propertyNames, but not unevaluatedProperties",
1593-
"data": { "banana": "available", "apple": true },
1594-
"valid": false
1595-
}
1596-
]
15971567
}
15981568
]

0 commit comments

Comments
 (0)