featureflags.schema.json

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
{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "https://onebranch.visualstudio.com/Build/_git/Powershell-FeatureFlags?path=%2Ffeatureflags.schema.json",
    "title": "Feature Flags Schema",
    "description": "Describes a schema for the Powershell-FeatureFlags configuration file.",
    "type": "object",
    "properties": {
        "stages": {
            "type": "object",
            "description": "Configuration for each roll-out stage.",
            "patternProperties": {
                "^\\S+$": {
                    "$ref": "#/definitions/conditions"
                }
            },
            "additionalProperties": false
        },
        "features": {
            "type": "object",
            "description": "Mapping of features to stages. Note that the JSON schema does not support validating values of this object (stages) to keys in the 'stages' section, so this validation is done by the library.",
            "patternProperties": {
                "^\\S+$": {
                    "$ref": "#/definitions/feature"
                }
            },
            "additionalProperties": false
        }
    },
    "required": ["stages"],
    "additionalProperties": false,
    "definitions": {
        "whitelist": {
            "type": "object",
            "properties": {
                "whitelist": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "required": ["whitelist"],
            "additionalProperties": false
        },
        "blacklist": {
            "type": "object",
            "properties": {
                "blacklist": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "required": ["blacklist"],
            "additionalProperties": false
        },
        "probability": {
            "type": "object",
            "properties": {
                "probability": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                }
            },
            "required": ["probability"],
            "additionalProperties": false
        },
        "conditions": {
            "type": "array",
            "items": {
                "oneOf": [{
                        "$ref": "#/definitions/whitelist"
                    },
                    {
                        "$ref": "#/definitions/blacklist"
                    },
                    {
                        "$ref": "#/definitions/probability"
                    }
                ]
            },
            "minItems": 1
        },
        "feature": {
            "type": "object",
            "properties": {
                "stages": {
                  "type": "array",
                  "items": {
                      "type": "string"
                  }
                },
                "description": {
                    "type": "string",
                    "description": "Description of the feature"
                },
                "environmentVariables": {
                    "type": "array",
                    "items": {
                        "type": "object"
                    },
                    "description": "Environment Variables to apply for the specified feature."
                }
            }
        }
    }
}