-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathflags.yaml
143 lines (143 loc) · 4.23 KB
/
flags.yaml
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
$id: "https://flagd.dev/schema/v0/flags.json"
$schema: http://json-schema.org/draft-07/schema#
title: flagd Flag Configuration
description: Defines flags for use in flagd, including typed variants and rules.
type: object
properties:
flags:
title: Flags
description: Top-level flags object. All flags are defined here.
type: object
$comment: flag objects are one of the 4 flag types defined in definitions
additionalProperties: false
patternProperties:
"^.{1,}$":
oneOf:
- title: Boolean flag
description: A flag having boolean values.
$ref: "#/definitions/booleanFlag"
- title: String flag
description: A flag having string values.
$ref: "#/definitions/stringFlag"
- title: Numeric flag
description: A flag having numeric values.
$ref: "#/definitions/numberFlag"
- title: Object flag
description: A flag having arbitrary object values.
$ref: "#/definitions/objectFlag"
$evaluators:
title: Evaluators
description: 'Reusable targeting rules that can be referenced with "$ref": "myRule"
in multiple flags.'
type: object
additionalProperties: false
patternProperties:
"^.{1,}$":
$comment: this relative ref means that targeting.json MUST be in the same
dir, or available on the same HTTP path
$ref: "./targeting.json"
metadata:
title: Flag Set Metadata
description: Metadata about the flag set, with keys of type string, and values of type boolean, string, or number.
properties:
id:
description: The unique identifier for the flag set.
type: string
version:
description: The version of the flag set.
type: string
$ref: "#/definitions/metadata"
definitions:
flag:
$comment: base flag object; no title/description here, allows for better UX,
keep it in the overrides
type: object
properties:
state:
title: Flag State
description: Indicates whether the flag is functional. Disabled flags are
treated as if they don't exist.
type: string
enum:
- ENABLED
- DISABLED
defaultVariant:
title: Default Variant
description: The variant to serve if no dynamic targeting applies (including
if the targeting returns null).
type: string
targeting:
$ref: "./targeting.json"
metadata:
title: Flag Metadata
description: Metadata about an individual feature flag, with keys of type string, and values of type boolean, string, or number.
$ref: "#/definitions/metadata"
required:
- state
- defaultVariant
booleanVariants:
type: object
properties:
variants:
type: object
additionalProperties: false
patternProperties:
"^.{1,}$":
type: boolean
default:
'true': true
'false': false
stringVariants:
type: object
properties:
variants:
type: object
additionalProperties: false
patternProperties:
"^.{1,}$":
type: string
numberVariants:
type: object
properties:
variants:
type: object
additionalProperties: false
patternProperties:
"^.{1,}$":
type: number
objectVariants:
type: object
properties:
variants:
type: object
additionalProperties: false
patternProperties:
"^.{1,}$":
type: object
booleanFlag:
$comment: merge the variants with the base flag to build our typed flags
allOf:
- $ref: "#/definitions/flag"
- $ref: "#/definitions/booleanVariants"
stringFlag:
allOf:
- $ref: "#/definitions/flag"
- $ref: "#/definitions/stringVariants"
numberFlag:
allOf:
- $ref: "#/definitions/flag"
- $ref: "#/definitions/numberVariants"
objectFlag:
allOf:
- $ref: "#/definitions/flag"
- $ref: "#/definitions/objectVariants"
metadata:
type: object
additionalProperties:
description: Any additional key/value pair with value of type boolean, string, or number.
type:
- string
- number
- boolean
# Metadata is optional
required: []