Skip to content

Commit 3b79a45

Browse files
authored
Merge pull request #418 from ChALkeR/chalker/contentSchema
Add tests for contentSchema
2 parents 3627cc1 + 29f609b commit 3b79a45

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

tests/draft2019-09/optional/content.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,55 @@
7373
"valid": true
7474
}
7575
]
76+
},
77+
{
78+
"description": "validation of binary-encoded media type documents with schema",
79+
"schema": {
80+
"contentMediaType": "application/json",
81+
"contentEncoding": "base64",
82+
"contentSchema": { "required": ["foo"], "properties": { "foo": { "type": "string" } } }
83+
},
84+
"tests": [
85+
{
86+
"description": "a valid base64-encoded JSON document",
87+
"data": "eyJmb28iOiAiYmFyIn0K",
88+
"valid": true
89+
},
90+
{
91+
"description": "another valid base64-encoded JSON document",
92+
"data": "eyJib28iOiAyMCwgImZvbyI6ICJiYXoifQ==",
93+
"valid": true
94+
},
95+
{
96+
"description": "an invalid base64-encoded JSON document",
97+
"data": "eyJib28iOiAyMH0=",
98+
"valid": false
99+
},
100+
{
101+
"description": "an empty object as a base64-encoded JSON document",
102+
"data": "e30=",
103+
"valid": false
104+
},
105+
{
106+
"description": "an empty array as a base64-encoded JSON document",
107+
"data": "W10=",
108+
"valid": true
109+
},
110+
{
111+
"description": "a validly-encoded invalid JSON document",
112+
"data": "ezp9Cg==",
113+
"valid": false
114+
},
115+
{
116+
"description": "an invalid base64 string that is valid JSON",
117+
"data": "{}",
118+
"valid": false
119+
},
120+
{
121+
"description": "ignores non-strings",
122+
"data": 100,
123+
"valid": true
124+
}
125+
]
76126
}
77127
]

0 commit comments

Comments
 (0)