Skip to content

Commit d27e000

Browse files
authored
fix: Broaden definition of hook data value types. (#307)
## This PR Loosens the value definition for hook data. In the example within the spec, and within the implementation in the dotnet-sdk, the intent was to allow any type of data. For example creating an open telemetry span in before, storing it hook data, and ending it in after. ### Notes Related to: open-feature/dotnet-sdk#387 --------- Signed-off-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
1 parent 2ba05d8 commit d27e000

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

specification.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@
928928
{
929929
"id": "Requirement 4.6.1",
930930
"machine_id": "requirement_4_6_1",
931-
"content": "`hook data` MUST be a structure supporting the definition of arbitrary properties, with keys of type `string`, and values of type `boolean | string | number | datetime | structure`.",
931+
"content": "`hook data` MUST be a structure supporting the definition of arbitrary properties, with keys of type `string`, and values of any type.",
932932
"RFC 2119 keyword": "MUST",
933933
"children": []
934934
},

specification/sections/04-hooks.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,4 +330,11 @@ but different hooks have different hook data instances.
330330

331331
#### Requirement 4.6.1
332332

333-
> `hook data` **MUST** be a structure supporting the definition of arbitrary properties, with keys of type `string`, and values of type `boolean | string | number | datetime | structure`.
333+
> `hook data` **MUST** be a structure supporting the definition of arbitrary properties, with keys of type `string`, and values of any type.
334+
335+
Access to hook data is restricted to only a single hook instance, and it has no serialization requirements, and as a result does not require any value type restrictions.
336+
337+
Example TypeScript definition:
338+
```JavaScript
339+
type HookData = Record<string, unknown>;
340+
```

0 commit comments

Comments
 (0)