Skip to content

Commit

Permalink
SDK-417 generate json for experimenter from ir (#4656)
Browse files Browse the repository at this point in the history
* [WIP] generate json for experimenter from ir

* adds tests for schema generation

* removes default featurs from jsonschema

* Adjust schema to accept key-value features

* Changes enum to string with enum variants

* cargo fmt

* fixes cli.yaml for experimenter
  • Loading branch information
Tarik Eshaq authored Nov 26, 2021
1 parent 214cb80 commit d53cfa8
Show file tree
Hide file tree
Showing 7 changed files with 486 additions and 13 deletions.
174 changes: 171 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions components/support/nimbus-fml/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ heck = "0.3.3"

[dev-dependencies]
tempdir = "0.3.7"
jsonschema = { version = "0.13", default-features = false }
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/Features",
"definitions": {
"Features": {
"patternProperties": {
"[a-zA-Z0-9_]+": {
"additionalProperties": false,
"type": "object",
"properties": {
"description": {
"type": "string"
},
"hasExposure": {
"type": "boolean",
"description": "If the feature sends an exposure event."
},
"exposureDescription": {
"type": "string",
"description": "A description of the implementation details of the exposure event, if one is sent."
},
"isEarlyStartup": {
"type": "boolean",
"description": "If the feature values should be cached in prefs for fast early startup."
},
"variables": {
"additionalProperties": false,
"type": "object",
"patternProperties": {
"[a-zA-Z0-9_]+": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"json",
"boolean",
"int",
"string"
]
},
"fallbackPref": {
"type": "string"
},
"enum": {
"description": "Validate feature value using a list of possible options (for string only values)."
},
"description": {
"type": "string",
"description": "Explain how this value is being used"
}
},
"required": [
"type",
"description"
],
"additionalProperties": false
}
}
}
},
"required": [
"description",
"hasExposure"
],
"if": {
"properties": {
"hasExposure": {
"const": true
}
}
},
"then": {
"required": [
"exposureDescription"
]
}
}
}
}
}
}
Loading

0 comments on commit d53cfa8

Please sign in to comment.