Skip to content

Commit 8c24a8d

Browse files
toddbaertskyerus
andauthored
Merging context (#117)
* Merging context Signed-off-by: Todd Baert <[email protected]> * Update specification/evaluation-context.md Co-authored-by: Skye Gill <[email protected]> Signed-off-by: Skye Gill <[email protected]> Signed-off-by: Todd Baert <[email protected]> Co-authored-by: Skye Gill <[email protected]>
1 parent c18fb0e commit 8c24a8d

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

specification.json

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,19 +286,33 @@
286286
]
287287
},
288288
{
289-
"id": "Requirement 3.1",
290-
"machine_id": "requirement_3_1",
289+
"id": "Requirement 3.1.1",
290+
"machine_id": "requirement_3_1_1",
291291
"content": "The `evaluation context` structure MUST define an optional `targeting key` field of type string, identifying the subject of the flag evaluation.",
292292
"RFC 2119 keyword": "MUST",
293293
"children": []
294294
},
295295
{
296-
"id": "Requirement 3.2",
297-
"machine_id": "requirement_3_2",
296+
"id": "Requirement 3.1.2",
297+
"machine_id": "requirement_3_1_2",
298298
"content": "The evaluation context MUST support the inclusion of custom fields, having keys of type `string`, and values of type `boolean | string | number | datetime | structure`.",
299299
"RFC 2119 keyword": "MUST",
300300
"children": []
301301
},
302+
{
303+
"id": "Requirement 3.2.1",
304+
"machine_id": "requirement_3_2_1",
305+
"content": "The API, Client and invocation MUST have a method for supplying `evaluation context`.",
306+
"RFC 2119 keyword": "MUST",
307+
"children": []
308+
},
309+
{
310+
"id": "Requirement 3.2.2",
311+
"machine_id": "requirement_3_2_2",
312+
"content": "Evaluation context MUST be merged in the order: API (global) - client - invocation, with duplicate values being overwritten.",
313+
"RFC 2119 keyword": "MUST",
314+
"children": []
315+
},
302316
{
303317
"id": "Requirement 4.1.1",
304318
"machine_id": "requirement_4_1_1",

specification/sections/03-evaluation-context.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,28 @@ NOTE: Field casing is not specified, and should be chosen in accordance with lan
2020

2121
see: [types](../types.md)
2222

23-
#### Requirement 3.1
23+
#### Requirement 3.1.1
2424

2525
> The `evaluation context` structure **MUST** define an optional `targeting key` field of type string, identifying the subject of the flag evaluation.
2626
2727
The targeting key uniquely identifies the subject (end-user, or client service) of a flag evaluation. Providers may require this field for fractional flag evaluation, rules, or overrides targeting specific users. Such providers may behave unpredictably if a targeting key is not specified at flag resolution.
2828

29-
#### Requirement 3.2
29+
#### Requirement 3.1.2
3030

3131
> The evaluation context **MUST** support the inclusion of custom fields, having keys of type `string`, and values of type `boolean | string | number | datetime | structure`.
3232
3333
see: [structure](../types.md#structure), [datetime](../types.md#datetime)
34+
35+
### Merging Context
36+
37+
#### Requirement 3.2.1
38+
39+
> The API, Client and invocation **MUST** have a method for supplying `evaluation context`.
40+
41+
API (global) `evaluation context` can be used to supply static data to flag evaluation, such as an application identifier, compute region, or hostname. Client and invocation `evaluation context` are ideal for dynamic data, such as end-user attributes.
42+
43+
#### Requirement 3.2.2
44+
45+
> Evaluation context **MUST** be merged in the order: API (global) -> client -> invocation, with duplicate values being overwritten.
46+
47+
Any fields defined in the client `evaluation context` will overwrite duplicate fields defined globally, and fields defined in the invocation `evaluation context` will overwrite duplicate fields defined in the globally or on the client.

0 commit comments

Comments
 (0)