1[ 2 { 3 "description": "validation of string-encoded content based on media type", 4 "schema": { 5 "contentMediaType": "application/json" 6 }, 7 "tests": [ 8 { 9 "description": "a valid JSON document", 10 "data": "{\"foo\": \"bar\"}", 11 "valid": true 12 }, 13 { 14 "description": "an invalid JSON document; validates true", 15 "data": "{:}", 16 "valid": true 17 }, 18 { 19 "description": "ignores non-strings", 20 "data": 100, 21 "valid": true 22 } 23 ] 24 }, 25 { 26 "description": "validation of binary string-encoding", 27 "schema": { 28 "contentEncoding": "base64" 29 }, 30 "tests": [ 31 { 32 "description": "a valid base64 string", 33 "data": "eyJmb28iOiAiYmFyIn0K", 34 "valid": true 35 }, 36 { 37 "description": "an invalid base64 string (% is not a valid character); validates true", 38 "data": "eyJmb28iOi%iYmFyIn0K", 39 "valid": true 40 }, 41 { 42 "description": "ignores non-strings", 43 "data": 100, 44 "valid": true 45 } 46 ] 47 }, 48 { 49 "description": "validation of binary-encoded media type documents", 50 "schema": { 51 "contentMediaType": "application/json", 52 "contentEncoding": "base64" 53 }, 54 "tests": [ 55 { 56 "description": "a valid base64-encoded JSON document", 57 "data": "eyJmb28iOiAiYmFyIn0K", 58 "valid": true 59 }, 60 { 61 "description": "a validly-encoded invalid JSON document; validates true", 62 "data": "ezp9Cg==", 63 "valid": true 64 }, 65 { 66 "description": "an invalid base64 string that is valid JSON; validates true", 67 "data": "{}", 68 "valid": true 69 }, 70 { 71 "description": "ignores non-strings", 72 "data": 100, 73 "valid": true 74 } 75 ] 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; validates true", 97 "data": "eyJib28iOiAyMH0=", 98 "valid": true 99 }, 100 { 101 "description": "an empty object as a base64-encoded JSON document; validates true", 102 "data": "e30=", 103 "valid": true 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; validates true", 112 "data": "ezp9Cg==", 113 "valid": true 114 }, 115 { 116 "description": "an invalid base64 string that is valid JSON; validates true", 117 "data": "{}", 118 "valid": true 119 }, 120 { 121 "description": "ignores non-strings", 122 "data": 100, 123 "valid": true 124 } 125 ] 126 } 127] 128