Skip to content

Commit 97b2220

Browse files
authored
chore: Update and repurpose evaluation context schema for Context values (#5764)
1 parent a22e219 commit 97b2220

1 file changed

Lines changed: 37 additions & 83 deletions

File tree

sdk/evaluation-context.json

Lines changed: 37 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,69 @@
11
{
22
"$defs": {
3-
"EnvironmentEvaluationContext": {
4-
"properties": {
5-
"api_key": {
6-
"title": "Api Key",
7-
"type": "string"
8-
}
9-
},
10-
"required": [
11-
"api_key"
12-
],
13-
"title": "EnvironmentEvaluationContext",
14-
"type": "object"
15-
},
16-
"FeatureEvaluationContext": {
3+
"EnvironmentContext": {
4+
"description": "Represents an environment context for feature flag evaluation.",
175
"properties": {
6+
"key": {
7+
"description": "An environment's unique identifier.",
8+
"title": "Key",
9+
"type": "string",
10+
"x-flagsmith-engine-path": "$.environment.key"
11+
},
1812
"name": {
13+
"description": "An environment's human-readable name.",
1914
"title": "Name",
20-
"type": "string"
15+
"type": "string",
16+
"x-flagsmith-engine-path": "$.environment.name"
2117
}
2218
},
2319
"required": [
20+
"key",
2421
"name"
2522
],
26-
"title": "FeatureEvaluationContext",
23+
"title": "EnvironmentContext",
2724
"type": "object"
2825
},
29-
"IdentityEvaluationContext": {
26+
"IdentityContext": {
27+
"description": "Represents an identity context for feature flag evaluation.",
3028
"properties": {
3129
"identifier": {
32-
"anyOf": [
33-
{
34-
"type": "string"
35-
},
36-
{
37-
"type": "null"
38-
}
39-
],
40-
"title": "Identifier"
30+
"description": "A unique identifier for an identity, used for segment and multivariate feature flag targeting, and displayed in the Flagsmith UI.",
31+
"title": "Identifier",
32+
"type": "string",
33+
"x-flagsmith-engine-path": "$.identity.identifier"
34+
},
35+
"key": {
36+
"description": "Key used when selecting a value for a multivariate feature, or for % split segmentation. Set to an internal identifier or a composite value based on the environment key and identifier, depending on Flagsmith implementation.",
37+
"title": "Key",
38+
"type": "string",
39+
"x-flagsmith-engine-path": "$.identity.key"
4140
},
4241
"traits": {
4342
"additionalProperties": {
44-
"anyOf": [
45-
{
46-
"$ref": "#/$defs/TraitEvaluationContext"
47-
},
48-
{
49-
"type": "null"
50-
}
51-
]
43+
"type": "string"
5244
},
45+
"description": "A map of traits associated with the identity, where the key is the trait name and the value is the trait value.",
5346
"title": "Traits",
5447
"type": "object"
55-
},
56-
"transient": {
57-
"anyOf": [
58-
{
59-
"type": "boolean"
60-
},
61-
{
62-
"type": "null"
63-
}
64-
],
65-
"default": null,
66-
"title": "Transient"
67-
}
68-
},
69-
"required": [],
70-
"title": "IdentityEvaluationContext",
71-
"type": "object"
72-
},
73-
"TraitEvaluationContext": {
74-
"properties": {
75-
"value": {},
76-
"transient": {
77-
"type": "boolean",
78-
"default": false,
79-
"title": "Transient"
8048
}
8149
},
8250
"required": [
83-
"value"
51+
"identifier",
52+
"key"
8453
],
85-
"title": "TraitEvaluationContext",
54+
"title": "IdentityContext",
8655
"type": "object"
8756
}
8857
},
58+
"description": "Represents a context object containing the necessary information to evaluate Flagsmith feature flags.",
8959
"properties": {
9060
"environment": {
91-
"anyOf": [
92-
{
93-
"$ref": "#/$defs/EnvironmentEvaluationContext"
94-
},
95-
{
96-
"type": "null"
97-
}
98-
],
99-
"default": null
61+
"$ref": "#/$defs/EnvironmentContext"
10062
},
10163
"identity": {
10264
"anyOf": [
10365
{
104-
"$ref": "#/$defs/IdentityEvaluationContext"
105-
},
106-
{
107-
"type": "null"
108-
}
109-
],
110-
"default": null
111-
},
112-
"feature": {
113-
"anyOf": [
114-
{
115-
"$ref": "#/$defs/FeatureEvaluationContext"
66+
"$ref": "#/$defs/IdentityContext"
11667
},
11768
{
11869
"type": "null"
@@ -121,6 +72,9 @@
12172
"default": null
12273
}
12374
},
124-
"title": "FlagsmithEvaluationContext",
75+
"required": [
76+
"environment"
77+
],
78+
"title": "EvaluationContext",
12579
"type": "object"
12680
}

0 commit comments

Comments
 (0)