cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/external/tests/draft4/patternProperties.json (about) 1 [ 2 { 3 "description": "patternProperties validates properties matching a regex", 4 "schema": { 5 "patternProperties": { 6 "f.*o": { 7 "type": "integer" 8 } 9 } 10 }, 11 "tests": [ 12 { 13 "description": "a single valid match is valid", 14 "data": { 15 "foo": 1 16 }, 17 "valid": true 18 }, 19 { 20 "description": "multiple valid matches is valid", 21 "data": { 22 "foo": 1, 23 "foooooo": 2 24 }, 25 "valid": true 26 }, 27 { 28 "description": "a single invalid match is invalid", 29 "data": { 30 "foo": "bar", 31 "fooooo": 2 32 }, 33 "valid": false 34 }, 35 { 36 "description": "multiple invalid matches is invalid", 37 "data": { 38 "foo": "bar", 39 "foooooo": "baz" 40 }, 41 "valid": false 42 }, 43 { 44 "description": "ignores arrays", 45 "data": [], 46 "valid": true 47 }, 48 { 49 "description": "ignores strings", 50 "data": "", 51 "valid": true 52 }, 53 { 54 "description": "ignores other non-objects", 55 "data": 12, 56 "valid": true 57 } 58 ] 59 }, 60 { 61 "description": "multiple simultaneous patternProperties are validated", 62 "schema": { 63 "patternProperties": { 64 "a*": { 65 "type": "integer" 66 }, 67 "aaa*": { 68 "maximum": 20 69 } 70 } 71 }, 72 "tests": [ 73 { 74 "description": "a single valid match is valid", 75 "data": { 76 "a": 21 77 }, 78 "valid": true 79 }, 80 { 81 "description": "a simultaneous match is valid", 82 "data": { 83 "aaaa": 18 84 }, 85 "valid": true 86 }, 87 { 88 "description": "multiple matches is valid", 89 "data": { 90 "a": 21, 91 "aaaa": 18 92 }, 93 "valid": true 94 }, 95 { 96 "description": "an invalid due to one is invalid", 97 "data": { 98 "a": "bar" 99 }, 100 "valid": false 101 }, 102 { 103 "description": "an invalid due to the other is invalid", 104 "data": { 105 "aaaa": 31 106 }, 107 "valid": false 108 }, 109 { 110 "description": "an invalid due to both is invalid", 111 "data": { 112 "aaa": "foo", 113 "aaaa": 31 114 }, 115 "valid": false 116 } 117 ] 118 }, 119 { 120 "description": "regexes are not anchored by default and are case sensitive", 121 "schema": { 122 "patternProperties": { 123 "[0-9]{2,}": { 124 "type": "boolean" 125 }, 126 "X_": { 127 "type": "string" 128 } 129 } 130 }, 131 "tests": [ 132 { 133 "description": "non recognized members are ignored", 134 "data": { 135 "answer 1": "42" 136 }, 137 "valid": true 138 }, 139 { 140 "description": "recognized members are accounted for", 141 "data": { 142 "a31b": null 143 }, 144 "valid": false 145 }, 146 { 147 "description": "regexes are case sensitive", 148 "data": { 149 "a_x_3": 3 150 }, 151 "valid": true 152 }, 153 { 154 "description": "regexes are case sensitive, 2", 155 "data": { 156 "a_X_3": 3 157 }, 158 "valid": false 159 } 160 ] 161 }, 162 { 163 "description": "patternProperties with null valued instance properties", 164 "schema": { 165 "patternProperties": { 166 "^.*bar$": { 167 "type": "null" 168 } 169 } 170 }, 171 "tests": [ 172 { 173 "description": "allows null values", 174 "data": { 175 "foobar": null 176 }, 177 "valid": true 178 } 179 ] 180 } 181 ]