Skip to content

Commit 7b3dcb1

Browse files
feat(schemas): Add support for setPref in SDK schemas
Because: - as of 152, Firefox for Android supports gecko prefs this commit: - adds support for setPref annotations in SDK manifests. Fixes #15511
1 parent c6619de commit 7b3dcb1

12 files changed

Lines changed: 76 additions & 3 deletions

File tree

schemas/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3001.0.0
1+
3001.1.0

schemas/index.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,14 @@ export interface SdkFeatureVariable {
758758
* Only allowed when type is string.
759759
*/
760760
enum?: string[];
761+
setPref?: SetPref1;
762+
}
763+
export interface SetPref1 {
764+
branch: PrefBranch;
765+
/**
766+
* The name of the pref to set.
767+
*/
768+
pref: string;
761769
}
762770
export interface AnalysisError {
763771
analysis_basis?: AnalysisBasis | null;

schemas/mozilla_nimbus_schemas/experimenter_apis/experiments/feature_manifests.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ class SdkFeatureVariable(BaseFeatureVariable):
5757
default=None,
5858
)
5959

60+
set_pref: SetPref | SkipJsonSchema[None] = Field(
61+
alias="setPref",
62+
description=(
63+
"A pref that should be set to the value of this variable when enrolling.\n"
64+
"\n"
65+
"Only supported in Firefox for Android 152+.\n"
66+
),
67+
default=None,
68+
)
69+
6070
model_config = ConfigDict(
6171
json_schema_extra={
6272
"dependentSchemas": {

schemas/mozilla_nimbus_schemas/tests/experiments/fixtures/feature_manifests/sdk/sdk.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,24 @@ zoom-feature:
311311
status:
312312
type: boolean
313313
description: "Whether the page zoom feature is enabled or not\n"
314+
pref-feature:
315+
description: A feature with prefs
316+
hasExposure: false
317+
variables:
318+
foo:
319+
type: boolean
320+
setPref:
321+
pref: test.foo
322+
branch: user
323+
324+
bar:
325+
type: string
326+
setPref:
327+
pref: test.bar
328+
branch: default
329+
330+
baz:
331+
type: int
332+
setPref:
333+
pref: test.baz
334+
branch: user

schemas/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mozilla/nimbus-schemas",
3-
"version": "3001.0.0",
3+
"version": "3001.1.0",
44
"description": "Schemas used by Mozilla Nimbus and related projects.",
55
"main": "index.d.ts",
66
"repository": {

schemas/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "mozilla-nimbus-schemas"
3-
version = "3001.0.0"
3+
version = "3001.1.0"
44
description = "Schemas used by Mozilla Nimbus and related projects."
55
authors = ["mikewilli"]
66
license = "MPL 2.0"

schemas/schemas/DesktopAllVersionsNimbusExperiment.schema.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@
342342
"type": "string"
343343
},
344344
"value": {
345+
"additionalProperties": true,
345346
"type": "object"
346347
},
347348
"enabled": {
@@ -394,6 +395,7 @@
394395
"type": "string"
395396
},
396397
"value": {
398+
"additionalProperties": true,
397399
"description": "The values that define the feature configuration. This should be validated against a schema.",
398400
"type": "object"
399401
}

schemas/schemas/DesktopNimbusExperiment.schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@
368368
"type": "string"
369369
},
370370
"value": {
371+
"additionalProperties": true,
371372
"description": "The values that define the feature configuration. This should be validated against a schema.",
372373
"type": "object"
373374
}

schemas/schemas/ExperimentFeatureConfig.schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"type": "string"
99
},
1010
"value": {
11+
"additionalProperties": true,
1112
"description": "The values that define the feature configuration. This should be validated against a schema.",
1213
"type": "object"
1314
}

schemas/schemas/NimbusExperimentV7.schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@
280280
"type": "string"
281281
},
282282
"value": {
283+
"additionalProperties": true,
283284
"description": "The values that define the feature configuration. This should be validated against a schema.",
284285
"type": "object"
285286
}

0 commit comments

Comments
 (0)