Skip to content

Commit 336ef8d

Browse files
authored
Merge pull request #452 from LeifRilbe/rilbe/propertyNames-with-pattern
Test cases for propertyNames with pattern.
2 parents b163efc + 2dfbc79 commit 336ef8d

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed

tests/draft2019-09/propertyNames.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,35 @@
4343
}
4444
]
4545
},
46+
{
47+
"description": "propertyNames validation with pattern",
48+
"schema": {
49+
"propertyNames": { "pattern": "^a+$" }
50+
},
51+
"tests": [
52+
{
53+
"description": "matching property names valid",
54+
"data": {
55+
"a": {},
56+
"aa": {},
57+
"aaa": {}
58+
},
59+
"valid": true
60+
},
61+
{
62+
"description": "non-matching property name is invalid",
63+
"data": {
64+
"aaA": {}
65+
},
66+
"valid": false
67+
},
68+
{
69+
"description": "object without properties is valid",
70+
"data": {},
71+
"valid": true
72+
}
73+
]
74+
},
4675
{
4776
"description": "propertyNames with boolean schema true",
4877
"schema": {"propertyNames": true},

tests/draft6/propertyNames.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,35 @@
4343
}
4444
]
4545
},
46+
{
47+
"description": "propertyNames validation with pattern",
48+
"schema": {
49+
"propertyNames": { "pattern": "^a+$" }
50+
},
51+
"tests": [
52+
{
53+
"description": "matching property names valid",
54+
"data": {
55+
"a": {},
56+
"aa": {},
57+
"aaa": {}
58+
},
59+
"valid": true
60+
},
61+
{
62+
"description": "non-matching property name is invalid",
63+
"data": {
64+
"aaA": {}
65+
},
66+
"valid": false
67+
},
68+
{
69+
"description": "object without properties is valid",
70+
"data": {},
71+
"valid": true
72+
}
73+
]
74+
},
4675
{
4776
"description": "propertyNames with boolean schema true",
4877
"schema": {"propertyNames": true},

tests/draft7/propertyNames.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,35 @@
4343
}
4444
]
4545
},
46+
{
47+
"description": "propertyNames validation with pattern",
48+
"schema": {
49+
"propertyNames": { "pattern": "^a+$" }
50+
},
51+
"tests": [
52+
{
53+
"description": "matching property names valid",
54+
"data": {
55+
"a": {},
56+
"aa": {},
57+
"aaa": {}
58+
},
59+
"valid": true
60+
},
61+
{
62+
"description": "non-matching property name is invalid",
63+
"data": {
64+
"aaA": {}
65+
},
66+
"valid": false
67+
},
68+
{
69+
"description": "object without properties is valid",
70+
"data": {},
71+
"valid": true
72+
}
73+
]
74+
},
4675
{
4776
"description": "propertyNames with boolean schema true",
4877
"schema": {"propertyNames": true},

0 commit comments

Comments
 (0)