Skip to content

Commit 0007965

Browse files
author
Michael Brewer
committed
fix(feature-toggles): correct json formatting and closing tags
1 parent 10142c4 commit 0007965

File tree

1 file changed

+85
-86
lines changed

1 file changed

+85
-86
lines changed

docs/utilities/feature_flags.md

Lines changed: 85 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -220,25 +220,25 @@ The `evaluate` method supports two optional parameters:
220220

221221
```json hl_lines="2 6 9-11"
222222
{
223-
"premium_features": {
224-
"default": false,
225-
"rules": {
226-
"customer tier equals premium": {
227-
"when_match": true,
228-
"conditions": [
229-
{
230-
"action": "EQUALS",
231-
"key": "tier",
232-
"value": "premium"
233-
}
234-
]
235-
}
223+
"premium_features": {
224+
"default": false,
225+
"rules": {
226+
"customer tier equals premium": {
227+
"when_match": true,
228+
"conditions": [
229+
{
230+
"action": "EQUALS",
231+
"key": "tier",
232+
"value": "premium"
233+
}
234+
]
235+
}
236+
}
237+
},
238+
"ten_percent_off_campaign": {
239+
"default": false
236240
}
237-
},
238-
"ten_percent_off_campaign": {
239-
"default": false
240-
}
241-
}
241+
}
242242
```
243243

244244
#### Static flags
@@ -273,10 +273,10 @@ In this case, we could omit the `context` parameter and simply evaluate whether
273273

274274
```json hl_lines="2-3"
275275
{
276-
"ten_percent_off_campaign": {
277-
"default": false
278-
}
279-
}
276+
"ten_percent_off_campaign": {
277+
"default": false
278+
}
279+
}
280280
```
281281

282282
### Getting all enabled features
@@ -328,58 +328,57 @@ You can use `get_enabled_features` method for scenarios where you need a list of
328328

329329
```json hl_lines="2 8"
330330
{
331-
"body": '{"username": "lessa", "tier": "premium", "basked_id": "random_id"}',
332-
"resource": "/products",
333-
"path": "/products",
334-
"httpMethod": "GET",
335-
"isBase64Encoded": false,
336-
"headers": {
337-
"CloudFront-Viewer-Country": "NL",
338-
}
331+
"body": "{\"username\": \"lessa\", \"tier\": \"premium\", \"basked_id\": \"random_id\"}",
332+
"resource": "/products",
333+
"path": "/products",
334+
"httpMethod": "GET",
335+
"isBase64Encoded": false,
336+
"headers": {
337+
"CloudFront-Viewer-Country": "NL"
338+
}
339339
}
340340
```
341341

342342
=== "features.json"
343343

344344
```json hl_lines="17-18 20 27-29"
345345
{
346-
"premium_features": {
347-
"default": false,
348-
"rules": {
349-
"customer tier equals premium": {
350-
"when_match": true,
351-
"conditions": [
352-
{
353-
"action": "EQUALS",
354-
"key": "tier",
355-
"value": "premium"
356-
}
357-
]
358-
}
359-
}
360-
},
361-
"ten_percent_off_campaign": {
362-
"default": true
363-
},
364-
"geo_customer_campaign": {
365-
"default": false,
366-
"rules": {
367-
"customer in temporary discount geo": {
368-
"when_match": true,
369-
"conditions": [
370-
{
371-
"action": "IN",
372-
"key": "CloudFront-Viewer-Country",
373-
"value": ["NL", "IE", "UK", "PL", "PT"},
374-
}
375-
]
376-
}
346+
"premium_features": {
347+
"default": false,
348+
"rules": {
349+
"customer tier equals premium": {
350+
"when_match": true,
351+
"conditions": [
352+
{
353+
"action": "EQUALS",
354+
"key": "tier",
355+
"value": "premium"
356+
}
357+
]
358+
}
359+
}
360+
},
361+
"ten_percent_off_campaign": {
362+
"default": true
363+
},
364+
"geo_customer_campaign": {
365+
"default": false,
366+
"rules": {
367+
"customer in temporary discount geo": {
368+
"when_match": true,
369+
"conditions": [
370+
{
371+
"action": "IN",
372+
"key": "CloudFront-Viewer-Country",
373+
"value": ["NL", "IE", "UK", "PL", "PT"]
374+
}
375+
]
376+
}
377+
}
377378
}
378-
}
379-
}
379+
}
380380
```
381381

382-
383382
## Advanced
384383

385384
### Schema
@@ -393,9 +392,9 @@ A feature can simply have its name and a `default` value. This is either on or o
393392
=== "minimal_schema.json"
394393
```json hl_lines="2-3"
395394
{
396-
"global_feature": {
397-
"default": true
398-
}
395+
"global_feature": {
396+
"default": true
397+
}
399398
}
400399
```
401400

@@ -413,21 +412,21 @@ When adding `rules` to a feature, they must contain:
413412

414413
```json hl_lines="4-11"
415414
{
416-
"premium_feature": {
417-
"default": false,
418-
"rules": {
419-
"customer tier equals premium": {
420-
"when_match": true,
421-
"conditions": [
422-
{
423-
"action": "EQUALS",
424-
"key": "tier",
425-
"value": "premium"
426-
}
427-
]
428-
}
415+
"premium_feature": {
416+
"default": false,
417+
"rules": {
418+
"customer tier equals premium": {
419+
"when_match": true,
420+
"conditions": [
421+
{
422+
"action": "EQUALS",
423+
"key": "tier",
424+
"value": "premium"
425+
}
426+
]
427+
}
428+
}
429429
}
430-
}
431430
}
432431
```
433432

@@ -442,11 +441,11 @@ The `conditions` block is a list of conditions that contain `action`, `key`, and
442441
{
443442
...
444443
"conditions": [
445-
{
446-
"action": "EQUALS",
447-
"key": "tier",
448-
"value": "premium"
449-
}
444+
{
445+
"action": "EQUALS",
446+
"key": "tier",
447+
"value": "premium"
448+
}
450449
]
451450
}
452451
```

0 commit comments

Comments
 (0)