You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: specification.json
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -692,7 +692,7 @@
692
692
{
693
693
"id": "Requirement 4.1.2",
694
694
"machine_id": "requirement_4_1_2",
695
-
"content": "The `hook context` SHOULD provide: access to the `client metadata` and the `provider metadata` fields.",
695
+
"content": "The `hook context` SHOULD provide access to the `client metadata` and the `provider metadata` fields.",
696
696
"RFC 2119 keyword": "SHOULD",
697
697
"children": []
698
698
},
@@ -721,7 +721,7 @@
721
721
{
722
722
"id": "Requirement 4.2.1",
723
723
"machine_id": "requirement_4_2_1",
724
-
"content": "`hook hints` MUST be a structure supports definition of arbitrary properties, with keys of type `string`, and values of type `boolean | string | number | datetime | structure`..",
724
+
"content": "`hook hints` MUST be a structure supports definition of arbitrary properties, with keys of type `string`, and values of type `boolean | string | number | datetime | structure`.",
725
725
"RFC 2119 keyword": "MUST",
726
726
"children": []
727
727
},
@@ -808,7 +808,7 @@
808
808
{
809
809
"id": "Requirement 4.3.6",
810
810
"machine_id": "requirement_4_3_6",
811
-
"content": "The `after` stage MUST run after flag resolution occurs. It accepts a `hook context` (required), `flag evaluation details` (required) and `hook hints` (optional). It has no return value.",
811
+
"content": "The `after` stage MUST run after flag resolution occurs. It accepts a `hook context` (required), `evaluation details` (required) and `hook hints` (optional). It has no return value.",
812
812
"RFC 2119 keyword": "MUST",
813
813
"children": []
814
814
},
@@ -822,7 +822,7 @@
822
822
{
823
823
"id": "Requirement 4.3.8",
824
824
"machine_id": "requirement_4_3_8",
825
-
"content": "The `finally` hook MUST run after the `before`, `after`, and `error` stages. It accepts a `hook context` (required)and `hook hints` (optional). There is no return value.",
825
+
"content": "The `finally` hook MUST run after the `before`, `after`, and `error` stages. It accepts a `hook context` (required), `evaluation details` (required) and `hook hints` (optional). It has no return value.",
Copy file name to clipboardExpand all lines: specification/sections/04-hooks.md
+14-9Lines changed: 14 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,8 +14,8 @@ Hooks add their logic at any of four specific stages of flag evaluation:
14
14
15
15
-`before`, immediately before flag evaluation
16
16
-`after`, immediately after successful flag evaluation
17
-
-`error`, immediately after an unsuccessful during flag evaluation
18
-
-`finally` unconditionally after flag evaluation
17
+
-`error`, immediately after an unsuccessful flag evaluation
18
+
-`finally`, unconditionally after flag evaluation
19
19
20
20
```mermaid
21
21
flowchart LR
@@ -27,11 +27,14 @@ flowchart LR
27
27
E -..-> F
28
28
```
29
29
30
-
Hooks can be configured to run globally (impacting all flag evaluations), per client, or per flag evaluation invocation. Some example use-cases for hook include adding additional data to the [evaluation context](./03-evaluation-context.md), performing validation on the received flag value, providing data to telemetric tools, and logging errors.
30
+
Hooks can be configured to run globally (impacting all flag evaluations), per client, or per flag evaluation invocation. Some example usecases for a hook include adding additional data to the [evaluation context](./03-evaluation-context.md), performing validation on the received flag value, providing data to telemetric tools, and logging errors.
31
31
32
32
### Definitions
33
33
34
-
**Hook**: Application author/integrator-supplied logic that is called by the OpenFeature framework at a specific stage. **Stage**: An explicit portion of the flag evaluation lifecycle. e.g. `before` being "before the [resolution](../glossary.md#resolving-flag-values) is run. **Invocation**: A single call to evaluate a flag. `client.getBooleanValue(..)` is an invocation. **API**: The global API singleton.
34
+
**Hook**: Application author/integrator-supplied logic that is called by the OpenFeature framework at a specific stage.
35
+
**Stage**: An explicit portion of the flag evaluation lifecycle. e.g. `before` being "before" the [resolution](../glossary.md#resolving-flag-values) is run.
36
+
**Invocation**: A single call to evaluate a flag. `client.getBooleanValue(..)` is an invocation.
37
+
**API**: The global API singleton.
35
38
36
39
### 4.1. Hook context
37
40
@@ -43,7 +46,7 @@ Hook context exists to provide hooks with information about the invocation.
43
46
44
47
#### Requirement 4.1.2
45
48
46
-
> The `hook context`**SHOULD** provide: access to the `client metadata` and the `provider metadata` fields.
49
+
> The `hook context`**SHOULD** provide access to the `client metadata` and the `provider metadata` fields.
> `hook hints`**MUST** be a structure supports definition of arbitrary properties, with keys of type `string`, and values of type `boolean | string | number | datetime | structure`..
69
+
> `hook hints`**MUST** be a structure supports definition of arbitrary properties, with keys of type `string`, and values of type `boolean | string | number | datetime | structure`.
67
70
68
71
#### Condition 4.2.2
69
72
@@ -129,15 +132,17 @@ Evaluation context merge order is defined in [Context levels and merging](./03-e
129
132
130
133
#### Requirement 4.3.6
131
134
132
-
> The `after` stage **MUST** run after flag resolution occurs. It accepts a `hook context` (required), `flag evaluation details` (required) and `hook hints` (optional). It has no return value.
135
+
> The `after` stage **MUST** run after flag resolution occurs. It accepts a `hook context` (required), `evaluation details` (required) and `hook hints` (optional). It has no return value.
133
136
134
137
#### Requirement 4.3.7
135
138
136
139
> The `error` hook **MUST** run when errors are encountered in the `before` stage, the `after` stage or during flag resolution. It accepts `hook context` (required), `exception` representing what went wrong (required), and `hook hints` (optional). It has no return value.
137
140
138
141
#### Requirement 4.3.8
139
142
140
-
> The `finally` hook **MUST** run after the `before`, `after`, and `error` stages. It accepts a `hook context` (required) and `hook hints` (optional). There is no return value.
143
+
> The `finally` hook **MUST** run after the `before`, `after`, and `error` stages. It accepts a `hook context` (required), `evaluation details` (required) and `hook hints` (optional). It has no return value.
144
+
145
+
The evaluation details passed to the `finally` stage matches the evaluation details returned to the application author.
141
146
142
147
#### Condition 4.3.9
143
148
@@ -179,7 +184,7 @@ client.getValue('my-flag', 'defaultValue', new Hook3());
179
184
180
185
> If a `finally` hook abnormally terminates, evaluation **MUST** proceed, including the execution of any remaining `finally` hooks.
181
186
182
-
In languages withtry/catch semantics, this means that exceptions thrown in`finally` hooks should be caught, and not propagated up the call stack.
187
+
In languages withtry/catch semantics, this means that exceptions thrown in`finally` hooks should be caught and not propagated up the call stack.
0 commit comments