Skip to content

Add tests for contentSchema #418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions tests/draft2019-09/optional/content.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,55 @@
"valid": true
}
]
},
{
"description": "validation of binary-encoded media type documents with schema",
"schema": {
"contentMediaType": "application/json",
"contentEncoding": "base64",
"contentSchema": { "required": ["foo"], "properties": { "foo": { "type": "string" } } }
},
"tests": [
{
"description": "a valid base64-encoded JSON document",
"data": "eyJmb28iOiAiYmFyIn0K",
"valid": true
},
{
"description": "another valid base64-encoded JSON document",
"data": "eyJib28iOiAyMCwgImZvbyI6ICJiYXoifQ==",
"valid": true
},
{
"description": "an invalid base64-encoded JSON document",
"data": "eyJib28iOiAyMH0=",
"valid": false
},
{
"description": "an empty object as a base64-encoded JSON document",
"data": "e30=",
"valid": false
},
{
"description": "an empty array as a base64-encoded JSON document",
"data": "W10=",
"valid": true
},
{
"description": "a validly-encoded invalid JSON document",
"data": "ezp9Cg==",
"valid": false
},
{
"description": "an invalid base64 string that is valid JSON",
"data": "{}",
"valid": false
},
{
"description": "ignores non-strings",
"data": 100,
"valid": true
}
]
}
]