summaryrefslogtreecommitdiffstats
path: root/toolkit/components/nimbus/schemas/NimbusEnrollment.schema.json
blob: 7f505102a0fb7e5b799b67cac0b87264bdbc20de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$ref": "#/definitions/NimbusEnrollment",
  "definitions": {
    "NimbusEnrollment": {
      "type": "object",
      "properties": {
        "slug": {
          "type": "string",
          "description": "Unique identifier for the experiment"
        },
        "userFacingName": {
          "type": "string",
          "description": "Public name of the experiment displayed on \"about:studies\""
        },
        "userFacingDescription": {
          "type": "string",
          "description": "Short public description of the experiment displayed on on \"about:studies\""
        },
        "isRollout": {
          "type": "boolean",
          "description": "When this property is set to true, treat this experiment as a rollout. Rollouts are currently handled as single-branch experiments separated from the bucketing namespace for normal experiments. See also: https://mozilla-hub.atlassian.net/browse/SDK-405"
        },
        "featureIds": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "A list of featureIds the experiment contains configurations for."
        },
        "branch": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "slug": {
                  "type": "string",
                  "description": "Identifier for the branch"
                },
                "feature": {
                  "type": "object",
                  "properties": {
                    "featureId": {
                      "type": "string",
                      "description": "The identifier for the feature flag"
                    },
                    "value": {
                      "type": "object",
                      "additionalProperties": {},
                      "description": "Optional extra params for the feature (this should be validated against a schema)"
                    }
                  },
                  "required": ["featureId", "value"],
                  "description": "A single feature configuration"
                }
              },
              "required": ["slug", "feature"]
            },
            {
              "type": "object",
              "properties": {
                "slug": {
                  "type": "string",
                  "description": "Identifier for the branch"
                },
                "feature": {
                  "type": "object",
                  "properties": {
                    "featureId": {
                      "type": "string",
                      "const": "unused-feature-id-for-legacy-support"
                    },
                    "enabled": {
                      "type": "boolean",
                      "const": false
                    },
                    "value": {
                      "type": "object",
                      "additionalProperties": {}
                    }
                  },
                  "required": ["featureId", "enabled", "value"],
                  "description": "The feature key must be provided with valid values to prevent crashes if the DTO is encountered by Desktop clients earlier than version 95."
                },
                "features": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "featureId": {
                        "type": "string",
                        "description": "The identifier for the feature flag"
                      },
                      "value": {
                        "type": "object",
                        "additionalProperties": {},
                        "description": "Optional extra params for the feature (this should be validated against a schema)"
                      }
                    },
                    "required": ["featureId", "value"]
                  },
                  "description": "An array of feature configurations"
                }
              },
              "required": ["slug", "feature", "features"]
            },
            {
              "type": "object",
              "properties": {
                "slug": {
                  "type": "string",
                  "description": "Identifier for the branch"
                },
                "features": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "featureId": {
                        "type": "string",
                        "description": "The identifier for the feature flag"
                      },
                      "value": {
                        "type": "object",
                        "additionalProperties": {},
                        "description": "Optional extra params for the feature (this should be validated against a schema)"
                      }
                    },
                    "required": ["featureId", "value"]
                  },
                  "description": "An array of feature configurations"
                }
              },
              "required": ["slug", "features"]
            }
          ],
          "description": "Branch configuration for the experiment"
        },
        "experimentType": {
          "type": "string",
          "description": "What kind of experiment this enrollment corresponds to."
        },
        "enrollmentId": {
          "type": "string",
          "description": "A unique identifier for the enrollment."
        },
        "active": {
          "type": "boolean",
          "description": "Whether or not the enrollment is active."
        },
        "lastSeen": {
          "type": "string",
          "format": "date-time",
          "description": "The last time the experiment was seen."
        },
        "force": {
          "type": "boolean",
          "description": "Whether or not this was a force enrollment."
        },
        "prefs": {
          "type": "array",
          "description": "Information about prefs set by this enrollment.",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "The name of the pref that was set."
              },
              "featureId": {
                "type": "string",
                "description": "The ID of the feature that owns the variable that set this pref."
              },
              "variable": {
                "type": "string",
                "description": "The variable that set this pref."
              },
              "branch": {
                "type": "string",
                "enum": ["user", "default"],
                "description": "The branch the pref was set on."
              },
              "originalValue": {
                "description": "The original value before the experiment."
              }
            },
            "additionalProperties": false
          }
        },
        "localizations": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "Per-locale localization substitutions.\n\nThe top level key is the locale (e.g., \"en-US\" or \"fr\"). Each entry is a mapping of string IDs to their localized equivalents.\n\nOnly supported on desktop."
        },
        "unenrollReason": {
          "type": "string",
          "description": "The reason for unenrollment. Only present when the enrollment is inactive."
        }
      },
      "required": [
        "slug",
        "userFacingName",
        "userFacingDescription",
        "branch",
        "enrollmentId",
        "active",
        "lastSeen"
      ],
      "description": "An enrollment in a Nimbus Experiment saved to disk"
    }
  }
}