From 3f44c85216b75608e8412d44808fc7563b23c6f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivar=20Conradi=20=C3=98sthus?= Date: Sun, 1 Nov 2020 20:51:31 +0100 Subject: [PATCH] fix: Variants missing from client API docs closes #632 --- docs/api/client/feature-toggles-api.md | 51 ++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/docs/api/client/feature-toggles-api.md b/docs/api/client/feature-toggles-api.md index b408a319fa..a49430e23e 100644 --- a/docs/api/client/feature-toggles-api.md +++ b/docs/api/client/feature-toggles-api.md @@ -140,3 +140,54 @@ In the example `environment` needs to be `production` AND `userId` must be eithe - **operator** - is the logical action to take on the values Supported operator are: - **IN** - constraint is satisfied if one of the values in the list matches the value for this context field in the context. - **NOT_IN** - constrint is satisfied if NONE of the values is the list matches the value for this field in the context. + +### Variants + +All feature toggles can also thke an array of variants. You can read more about [feature toggle variants](../../feature-toggle-variants). + +```json +{ + "version": 1, + "features": [ + { + "name": "Demo", + "description": "Show off fedfdfature toggles!", + "type": "operational", + "enabled": true, + "stale": false, + "strategies": [ + { + "name": "default" + } + ], + "variants": [ + { + "name": "red", + "weight": 500, + "weightType": "variable", + "payload": { + "type": "string", + "value": "something" + }, + "overrides": [ + { + "contextName": "userId", + "values": ["123"] + } + ] + }, + { + "name": "blue", + "weight": 500, + "overrides": [], + "weightType": "variable" + } + ], + "createdAt": "2020-09-01T07:14:39.438Z" + } + ] +} +``` + +- **payload** - an optional object representing a payload to the variant. Takes two properties if present `type` and `value`. +- **overrides** - an optional array of overrides. If any context field matches any of the the defined overrides it means that the variant should be selected.