|
| 1 | +{ |
| 2 | + "kind": "featurevisor.openfeature-provider", |
| 3 | + "schemaVersion": 1, |
| 4 | + "datafile": { |
| 5 | + "schemaVersion": "2", |
| 6 | + "revision": "provider-conformance", |
| 7 | + "segments": {}, |
| 8 | + "features": { |
| 9 | + "checkout": { |
| 10 | + "bucketBy": "userId", |
| 11 | + "variations": [ |
| 12 | + { "value": "on", "variables": { "config": "{\"enabled\":true}", "nullable": "null" } } |
| 13 | + ], |
| 14 | + "variablesSchema": { |
| 15 | + "config": { "type": "json", "defaultValue": "{}" }, |
| 16 | + "nullable": { "type": "json", "defaultValue": "null" } |
| 17 | + }, |
| 18 | + "force": [ |
| 19 | + { |
| 20 | + "conditions": { "attribute": "userId", "operator": "equals", "value": "forced" }, |
| 21 | + "enabled": true, |
| 22 | + "variation": "on" |
| 23 | + } |
| 24 | + ], |
| 25 | + "traffic": [{ "key": "all", "segments": "*", "percentage": 100000, "variation": "on" }] |
| 26 | + }, |
| 27 | + "disabled": { |
| 28 | + "bucketBy": "userId", |
| 29 | + "variations": [], |
| 30 | + "force": [ |
| 31 | + { |
| 32 | + "conditions": { "attribute": "blocked", "operator": "equals", "value": true }, |
| 33 | + "enabled": false |
| 34 | + } |
| 35 | + ], |
| 36 | + "traffic": [] |
| 37 | + }, |
| 38 | + "accountTargeted": { |
| 39 | + "bucketBy": "accountId", |
| 40 | + "variations": [], |
| 41 | + "force": [ |
| 42 | + { |
| 43 | + "conditions": { "attribute": "accountId", "operator": "equals", "value": "" }, |
| 44 | + "enabled": true |
| 45 | + } |
| 46 | + ], |
| 47 | + "traffic": [] |
| 48 | + }, |
| 49 | + "targetOnly": { |
| 50 | + "bucketBy": "userId", |
| 51 | + "variations": [], |
| 52 | + "force": [ |
| 53 | + { |
| 54 | + "conditions": { "attribute": "userId", "operator": "equals", "value": "forced" }, |
| 55 | + "enabled": true |
| 56 | + } |
| 57 | + ], |
| 58 | + "traffic": [] |
| 59 | + }, |
| 60 | + "conditional": { |
| 61 | + "bucketBy": "userId", |
| 62 | + "conditions": { "feature": "checkout", "enabled": false }, |
| 63 | + "traffic": [{ "key": "all", "conditions": "*", "percentage": 100000 }] |
| 64 | + } |
| 65 | + }, |
| 66 | + "variables": { |
| 67 | + "settings": { "type": "json", "defaultValue": "{\"region\":\"eu\"}" }, |
| 68 | + "nullable": { "type": "json", "defaultValue": "null" }, |
| 69 | + "settingsAlias": { "type": "json", "compose": "settings" }, |
| 70 | + "jsonText": { "type": "json", "defaultValue": "\"null\"" }, |
| 71 | + "jsonTextAlias": { "type": "json", "compose": "jsonText" }, |
| 72 | + "screen": { |
| 73 | + "type": "object", |
| 74 | + "compose": [ |
| 75 | + { "key": "enabled", "feature": "checkout" }, |
| 76 | + { "key": "settings", "variable": "settings" } |
| 77 | + ] |
| 78 | + }, |
| 79 | + "restricted": { |
| 80 | + "type": "boolean", |
| 81 | + "defaultValue": true, |
| 82 | + "disabledValue": false, |
| 83 | + "conditions": { "attribute": "allowed", "operator": "equals", "value": true } |
| 84 | + }, |
| 85 | + "screenOverride": { |
| 86 | + "type": "object", |
| 87 | + "compose": "screen", |
| 88 | + "overrideProgram": [ |
| 89 | + { |
| 90 | + "key": "regional", |
| 91 | + "conditions": "*", |
| 92 | + "operations": [{ "op": "set", "path": ["settings", "region"], "value": "us" }], |
| 93 | + "onMatch": 1, |
| 94 | + "onMiss": 1 |
| 95 | + } |
| 96 | + ] |
| 97 | + }, |
| 98 | + "brokenAlias": { "type": "object", "compose": "brokenAlias" } |
| 99 | + } |
| 100 | + }, |
| 101 | + "cases": [ |
| 102 | + { |
| 103 | + "name": "forced flag", |
| 104 | + "flagKey": "checkout", |
| 105 | + "type": "boolean", |
| 106 | + "default": false, |
| 107 | + "context": { "targetingKey": "forced" }, |
| 108 | + "expected": { "value": true, "reason": "TARGETING_MATCH" } |
| 109 | + }, |
| 110 | + { |
| 111 | + "name": "variation selector", |
| 112 | + "flagKey": "checkout:variation", |
| 113 | + "type": "string", |
| 114 | + "default": "fallback", |
| 115 | + "context": { "targetingKey": "forced" }, |
| 116 | + "expected": { "value": "on", "reason": "TARGETING_MATCH", "variant": "on" } |
| 117 | + }, |
| 118 | + { |
| 119 | + "name": "feature JSON", |
| 120 | + "flagKey": "checkout:config", |
| 121 | + "type": "object", |
| 122 | + "default": {}, |
| 123 | + "context": { "targetingKey": "forced" }, |
| 124 | + "expected": { "value": { "enabled": true } } |
| 125 | + }, |
| 126 | + { |
| 127 | + "name": "global JSON", |
| 128 | + "flagKey": "variable:settings", |
| 129 | + "type": "object", |
| 130 | + "default": {}, |
| 131 | + "context": {}, |
| 132 | + "expected": { "value": { "region": "eu" }, "reason": "DEFAULT" } |
| 133 | + }, |
| 134 | + { |
| 135 | + "name": "feature JSON null", |
| 136 | + "flagKey": "checkout:nullable", |
| 137 | + "type": "object", |
| 138 | + "default": { "fallback": true }, |
| 139 | + "context": { "targetingKey": "forced" }, |
| 140 | + "expected": { "value": { "fallback": true } } |
| 141 | + }, |
| 142 | + { |
| 143 | + "name": "global JSON null", |
| 144 | + "flagKey": "variable:nullable", |
| 145 | + "type": "object", |
| 146 | + "default": { "fallback": true }, |
| 147 | + "context": {}, |
| 148 | + "expected": { "value": { "fallback": true }, "reason": "DEFAULT" } |
| 149 | + }, |
| 150 | + { |
| 151 | + "name": "disabled flag", |
| 152 | + "flagKey": "disabled", |
| 153 | + "type": "boolean", |
| 154 | + "default": true, |
| 155 | + "context": { "blocked": true }, |
| 156 | + "expected": { "value": false, "reason": "TARGETING_MATCH" } |
| 157 | + }, |
| 158 | + { |
| 159 | + "name": "missing flag", |
| 160 | + "flagKey": "missing", |
| 161 | + "type": "boolean", |
| 162 | + "default": false, |
| 163 | + "context": {}, |
| 164 | + "expected": { "value": false, "reason": "ERROR", "errorCode": "FLAG_NOT_FOUND" } |
| 165 | + }, |
| 166 | + { |
| 167 | + "name": "type mismatch", |
| 168 | + "flagKey": "checkout:config", |
| 169 | + "type": "string", |
| 170 | + "default": "fallback", |
| 171 | + "context": { "targetingKey": "forced" }, |
| 172 | + "expected": { "value": "fallback", "reason": "ERROR", "errorCode": "TYPE_MISMATCH" } |
| 173 | + }, |
| 174 | + { |
| 175 | + "name": "composed object", |
| 176 | + "flagKey": "variable:screen", |
| 177 | + "type": "object", |
| 178 | + "default": {}, |
| 179 | + "context": { "targetingKey": "forced" }, |
| 180 | + "expected": { |
| 181 | + "value": { "enabled": true, "settings": { "region": "eu" } }, |
| 182 | + "reason": "TARGETING_MATCH" |
| 183 | + } |
| 184 | + }, |
| 185 | + { |
| 186 | + "name": "string alias to JSON object", |
| 187 | + "flagKey": "variable:settingsAlias", |
| 188 | + "type": "object", |
| 189 | + "default": {}, |
| 190 | + "context": {}, |
| 191 | + "expected": { "value": { "region": "eu" }, "reason": "TARGETING_MATCH" } |
| 192 | + }, |
| 193 | + { |
| 194 | + "name": "string alias decodes JSON exactly once", |
| 195 | + "flagKey": "variable:jsonTextAlias", |
| 196 | + "type": "string", |
| 197 | + "default": "fallback", |
| 198 | + "context": {}, |
| 199 | + "expected": { "value": "null", "reason": "TARGETING_MATCH" } |
| 200 | + }, |
| 201 | + { |
| 202 | + "name": "composed override", |
| 203 | + "flagKey": "variable:screenOverride", |
| 204 | + "type": "object", |
| 205 | + "default": {}, |
| 206 | + "context": { "targetingKey": "forced" }, |
| 207 | + "expected": { |
| 208 | + "value": { "enabled": true, "settings": { "region": "us" } }, |
| 209 | + "reason": "TARGETING_MATCH" |
| 210 | + } |
| 211 | + }, |
| 212 | + { |
| 213 | + "name": "unmet variable root conditions", |
| 214 | + "flagKey": "variable:restricted", |
| 215 | + "type": "boolean", |
| 216 | + "default": true, |
| 217 | + "context": {}, |
| 218 | + "expected": { "value": false, "reason": "DISABLED" } |
| 219 | + }, |
| 220 | + { |
| 221 | + "name": "unmet feature root conditions", |
| 222 | + "flagKey": "conditional", |
| 223 | + "type": "boolean", |
| 224 | + "default": true, |
| 225 | + "context": { "targetingKey": "forced" }, |
| 226 | + "expected": { "value": false, "reason": "DISABLED" } |
| 227 | + }, |
| 228 | + { |
| 229 | + "name": "composition dependency error", |
| 230 | + "flagKey": "variable:brokenAlias", |
| 231 | + "type": "object", |
| 232 | + "default": { "fallback": true }, |
| 233 | + "context": {}, |
| 234 | + "expected": { "value": { "fallback": true }, "reason": "ERROR", "errorCode": "GENERAL" } |
| 235 | + } |
| 236 | + ], |
| 237 | + "targetingCases": [ |
| 238 | + { |
| 239 | + "name": "absent preserves field", |
| 240 | + "context": { "userId": "forced" }, |
| 241 | + "expectedUserId": "forced", |
| 242 | + "expectedValue": true |
| 243 | + }, |
| 244 | + { |
| 245 | + "name": "empty overrides field", |
| 246 | + "context": { "targetingKey": "", "userId": "forced" }, |
| 247 | + "expectedUserId": "", |
| 248 | + "expectedValue": false |
| 249 | + }, |
| 250 | + { |
| 251 | + "name": "nonempty overrides field", |
| 252 | + "context": { "targetingKey": "other", "userId": "forced" }, |
| 253 | + "expectedUserId": "other", |
| 254 | + "expectedValue": false |
| 255 | + } |
| 256 | + ], |
| 257 | + "customTargetingCase": { |
| 258 | + "flagKey": "accountTargeted", |
| 259 | + "context": { "targetingKey": "", "accountId": "old" }, |
| 260 | + "targetingKeyField": "accountId", |
| 261 | + "expectedValue": true, |
| 262 | + "expectedReason": "TARGETING_MATCH" |
| 263 | + } |
| 264 | +} |
0 commit comments