Skip to content

Commit 87ab28a

Browse files
authored
fix: change $defs to definitions per draft07 (#140)
`$defs` works, but it its not part of draft07 which leads to odd warnings in some implementations. I've switched this to `definitions` as per the spec. see: https://json-schema.org/draft-07/draft-handrews-json-schema-validation-01#rfc.section.9 fixes: open-feature/flagd#1309 Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
1 parent fae9beb commit 87ab28a

File tree

4 files changed

+168
-168
lines changed

4 files changed

+168
-168
lines changed

json/flags.json

+17-17
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,30 @@
99
"title": "Flags",
1010
"description": "Top-level flags object. All flags are defined here.",
1111
"type": "object",
12-
"$comment": "flag objects are one of the 4 flag types defined in $defs",
12+
"$comment": "flag objects are one of the 4 flag types defined in definitions",
1313
"additionalProperties": false,
1414
"patternProperties": {
1515
"^.{1,}$": {
1616
"oneOf": [
1717
{
1818
"title": "Boolean flag",
1919
"description": "A flag having boolean values.",
20-
"$ref": "#/$defs/booleanFlag"
20+
"$ref": "#/definitions/booleanFlag"
2121
},
2222
{
2323
"title": "String flag",
2424
"description": "A flag having string values.",
25-
"$ref": "#/$defs/stringFlag"
25+
"$ref": "#/definitions/stringFlag"
2626
},
2727
{
2828
"title": "Numeric flag",
2929
"description": "A flag having numeric values.",
30-
"$ref": "#/$defs/numberFlag"
30+
"$ref": "#/definitions/numberFlag"
3131
},
3232
{
3333
"title": "Object flag",
3434
"description": "A flag having arbitrary object values.",
35-
"$ref": "#/$defs/objectFlag"
35+
"$ref": "#/definitions/objectFlag"
3636
}
3737
]
3838
}
@@ -46,12 +46,12 @@
4646
"patternProperties": {
4747
"^.{1,}$": {
4848
"$comment": "this relative ref means that targeting.json MUST be in the same dir, or available on the same HTTP path",
49-
"$ref": "./targeting.json#/$defs/targeting"
49+
"$ref": "./targeting.json#/definitions/targeting"
5050
}
5151
}
5252
}
5353
},
54-
"$defs": {
54+
"definitions": {
5555
"flag": {
5656
"$comment": "base flag object; no title/description here, allows for better UX, keep it in the overrides",
5757
"type": "object",
@@ -71,7 +71,7 @@
7171
"type": "string"
7272
},
7373
"targeting": {
74-
"$ref": "./targeting.json#/$defs/targeting"
74+
"$ref": "./targeting.json#/definitions/targeting"
7575
}
7676
},
7777
"required": [
@@ -139,44 +139,44 @@
139139
}
140140
}
141141
},
142-
"$comment": "merge the variants with the base flag to build our typed flags",
143142
"booleanFlag": {
143+
"$comment": "merge the variants with the base flag to build our typed flags",
144144
"allOf": [
145145
{
146-
"$ref": "#/$defs/flag"
146+
"$ref": "#/definitions/flag"
147147
},
148148
{
149-
"$ref": "#/$defs/booleanVariants"
149+
"$ref": "#/definitions/booleanVariants"
150150
}
151151
]
152152
},
153153
"stringFlag": {
154154
"allOf": [
155155
{
156-
"$ref": "#/$defs/flag"
156+
"$ref": "#/definitions/flag"
157157
},
158158
{
159-
"$ref": "#/$defs/stringVariants"
159+
"$ref": "#/definitions/stringVariants"
160160
}
161161
]
162162
},
163163
"numberFlag": {
164164
"allOf": [
165165
{
166-
"$ref": "#/$defs/flag"
166+
"$ref": "#/definitions/flag"
167167
},
168168
{
169-
"$ref": "#/$defs/numberVariants"
169+
"$ref": "#/definitions/numberVariants"
170170
}
171171
]
172172
},
173173
"objectFlag": {
174174
"allOf": [
175175
{
176-
"$ref": "#/$defs/flag"
176+
"$ref": "#/definitions/flag"
177177
},
178178
{
179-
"$ref": "#/$defs/objectVariants"
179+
"$ref": "#/definitions/objectVariants"
180180
}
181181
]
182182
}

json/flags.yaml

+17-17
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ properties:
88
title: Flags
99
description: Top-level flags object. All flags are defined here.
1010
type: object
11-
$comment: flag objects are one of the 4 flag types defined in $defs
11+
$comment: flag objects are one of the 4 flag types defined in definitions
1212
additionalProperties: false
1313
patternProperties:
1414
"^.{1,}$":
1515
oneOf:
1616
- title: Boolean flag
1717
description: A flag having boolean values.
18-
$ref: "#/$defs/booleanFlag"
18+
$ref: "#/definitions/booleanFlag"
1919
- title: String flag
2020
description: A flag having string values.
21-
$ref: "#/$defs/stringFlag"
21+
$ref: "#/definitions/stringFlag"
2222
- title: Numeric flag
2323
description: A flag having numeric values.
24-
$ref: "#/$defs/numberFlag"
24+
$ref: "#/definitions/numberFlag"
2525
- title: Object flag
2626
description: A flag having arbitrary object values.
27-
$ref: "#/$defs/objectFlag"
27+
$ref: "#/definitions/objectFlag"
2828
$evaluators:
2929
title: Evaluators
3030
description: 'Reusable targeting rules that can be referenced with "$ref": "myRule"
@@ -35,8 +35,8 @@ properties:
3535
"^.{1,}$":
3636
$comment: this relative ref means that targeting.json MUST be in the same
3737
dir, or available on the same HTTP path
38-
$ref: "./targeting.json#/$defs/targeting"
39-
"$defs":
38+
$ref: "./targeting.json#/definitions/targeting"
39+
definitions:
4040
flag:
4141
$comment: base flag object; no title/description here, allows for better UX,
4242
keep it in the overrides
@@ -56,7 +56,7 @@ properties:
5656
if the targeting returns null).
5757
type: string
5858
targeting:
59-
$ref: "./targeting.json#/$defs/targeting"
59+
$ref: "./targeting.json#/definitions/targeting"
6060
required:
6161
- state
6262
- defaultVariant
@@ -99,20 +99,20 @@ properties:
9999
patternProperties:
100100
"^.{1,}$":
101101
type: object
102-
$comment: merge the variants with the base flag to build our typed flags
103102
booleanFlag:
103+
$comment: merge the variants with the base flag to build our typed flags
104104
allOf:
105-
- $ref: "#/$defs/flag"
106-
- $ref: "#/$defs/booleanVariants"
105+
- $ref: "#/definitions/flag"
106+
- $ref: "#/definitions/booleanVariants"
107107
stringFlag:
108108
allOf:
109-
- $ref: "#/$defs/flag"
110-
- $ref: "#/$defs/stringVariants"
109+
- $ref: "#/definitions/flag"
110+
- $ref: "#/definitions/stringVariants"
111111
numberFlag:
112112
allOf:
113-
- $ref: "#/$defs/flag"
114-
- $ref: "#/$defs/numberVariants"
113+
- $ref: "#/definitions/flag"
114+
- $ref: "#/definitions/numberVariants"
115115
objectFlag:
116116
allOf:
117-
- $ref: "#/$defs/flag"
118-
- $ref: "#/$defs/objectVariants"
117+
- $ref: "#/definitions/flag"
118+
- $ref: "#/definitions/objectVariants"

0 commit comments

Comments
 (0)