@@ -17,5 +17,66 @@ go get github.com/open-feature/go-sdk-contrib/providers/launchdarkly/pkg
17
17
## Usage
18
18
See [ example_test.go] ( ./example_test.go )
19
19
20
+ ## Representing LaunchDarkly (multi) contexts
21
+
22
+ The LaunchDarkly provider expects contexts to be either single- or
23
+ multi-context, matching [ LaunchDarkly's concept of Contexts] ( https://docs.launchdarkly.com/guides/flags/intro-contexts ) .
24
+ The representation of LaunchDarkly context(s) within the OpenFeature
25
+ context needs to be well-formed.
26
+
27
+ ### Single context
28
+
29
+ ``` JSON
30
+ {
31
+ // The "kind" of the context. Required.
32
+ // Cannot be missing, empty, "multi", or "kind".
33
+ // Must match `[a-zA-Z0-9._-]*`
34
+ // (The default LaunchDarkly kind is "user".)
35
+ kind: string,
36
+
37
+ // The targeting key. One of the following is required to be
38
+ // present and non-empty. If both are present, `targetingKey`
39
+ // takes precedence.
40
+ key: string,
41
+ targetingKey: string,
42
+
43
+ // Private attribute annotations. Optional.
44
+ // See https://docs.launchdarkly.com/sdk/features/private-attributes
45
+ // for the formatting specifications.
46
+ privateAttributes: [string],
47
+
48
+ // Anonymous annotation. Optional.
49
+ // See https://docs.launchdarkly.com/sdk/features/anonymous
50
+ anonymous: bool,
51
+
52
+ // Name. Optional.
53
+ // If present, used by LaunchDarkly as the display name of the context.
54
+ name: string|null,
55
+
56
+ // Further attributes, in the normal OpenFeature format.
57
+ // Attribute names can be any non-empty string except "_meta".
58
+ //
59
+ // Repeated `string: any`
60
+ }
61
+ ```
62
+
63
+ ### Multi context
64
+
65
+ ``` JSON
66
+ {
67
+ // The "kind" of the context. Required.
68
+ // Must be "multi".
69
+ kind: "multi",
70
+
71
+ // Sub-contexts. Each further key is taken to be a "kind" (and
72
+ // thus must match `[a-zA-Z0-9._-]`).
73
+ // The value is should be an object, and is processed using the
74
+ // rules described in [Single context](#single-context) above,
75
+ // except that the "kind" attribute is ignored if present.
76
+ //
77
+ // Repeated `string: object`
78
+ }
79
+ ```
80
+
20
81
### References
21
82
* https://docs.openfeature.dev/blog/creating-a-provider-for-the-go-sdk/
0 commit comments