Skip to content

Commit cd13959

Browse files
committed
Add conditional tests just to make sure the baseline works
1 parent 6012846 commit cd13959

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"type": "object",
3+
"properties": {
4+
"street_address": {
5+
"type": "string"
6+
},
7+
"country": {
8+
"default": "United States of America",
9+
"enum": ["United States of America", "Canada"]
10+
}
11+
},
12+
"if": {
13+
"properties": { "country": { "const": "United States of America" } }
14+
},
15+
"then": {
16+
"properties": { "postal_code": { "pattern": "[0-9]{5}(-[0-9]{4})?" } }
17+
},
18+
"else": {
19+
"properties": { "postal_code": { "pattern": "[A-Z][0-9][A-Z] [0-9][A-Z][0-9]" } }
20+
}
21+
}
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
data.postal_code must match pattern [A-Z][0-9][A-Z] [0-9][A-Z][0-9]
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"street_address": "24 Sussex Drive",
3+
"country": "Canada",
4+
"postal_code": "10000"
5+
}

tests/examples/conditional/valid.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"street_address": "1600 Pennsylvania Avenue NW",
3+
"country": "United States of America",
4+
"postal_code": "20500"
5+
}

0 commit comments

Comments
 (0)