You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -64,6 +64,11 @@ that concept to solve this problem.
64
64
}
65
65
```
66
66
67
+
* Good, because it handle the most common use case: string property values
68
+
* Good, because all property values are grouped together
69
+
* Good, because it's less verbose
70
+
* Bad, because it doesn't handle non-string property values
71
+
67
72
### Option 2
68
73
69
74
This version uses an array of objects. Each object is a collection of the
@@ -89,6 +94,11 @@ prone.
89
94
}
90
95
```
91
96
97
+
* Good, because it supports all use cases
98
+
* Bad, because properties are not naturally grouped together
99
+
* Bad, because it's quite verbose
100
+
* Bad, because we have no precedent for a keyword which explicitly defines its own properties. This would be new operational functionality, which we try to avoid if we can.
101
+
92
102
### Option 3
93
103
94
104
A slight variation on that example is to make it a map of keyword to dependency
@@ -111,6 +121,11 @@ object. It's still too verbose.
111
121
}
112
122
```
113
123
124
+
* Good, because it supports all use cases
125
+
* Good, because all property values are grouped together
126
+
* Bad, because it's quite verbose
127
+
* Bad, because we have no precedent for a keyword which explicitly defines its own properties. This would be new operational functionality, which we try to avoid if we can.
128
+
114
129
### Option 4
115
130
116
131
This one is a little more consistent with the JSON Schema style (poor keyword
@@ -133,7 +148,12 @@ naming aside), but otherwise has all the same problems as the other examples.
133
148
}
134
149
```
135
150
136
-
### Option 4
151
+
* Good, because it supports all use cases
152
+
* Bad, because properties are not naturally grouped together
153
+
* Bad, because it's very verbose
154
+
* Bad, because it introduces a lot of inter-keyword dependencies, which we'd have to exhaustively define
155
+
156
+
### Option 5
137
157
138
158
This one is a variation of `if` that combines `if`, `properties`, and `required`
139
159
to reduce boilerplate. It's also essentially a variation of the previous example
@@ -159,6 +179,12 @@ verbose.
159
179
}
160
180
```
161
181
182
+
* Good, because it supports all use cases
183
+
* Good, because it's a familiar syntax
184
+
* Bad, because properties are not naturally grouped together
185
+
* Bad, because it's very verbose
186
+
* Bad, because `ifProperties` is very niche. Will this spawn a new series of `if*` keywords? How would it interact with `if`?
187
+
162
188
### Option 6
163
189
164
190
All of the previous alternatives use a schema as the discriminator. This
@@ -178,6 +204,9 @@ intuitive as the chosen solution.
178
204
}
179
205
```
180
206
207
+
* Good, because it supports all use cases
208
+
* Bad, because it's an unintuitive syntax and easy to get wrong
209
+
* Bad, because properties are not naturally grouped together
181
210
182
211
## Decision Outcome
183
212
@@ -197,58 +226,6 @@ cases carried a lower priority.
197
226
- Properties with non-string values cannot be supported using this keyword and
198
227
the `allOf`-`if`-`then` pattern must still be used.
199
228
200
-
## Pros and Cons of the Options <!-- optional -->
201
-
202
-
### [option 1]
203
-
204
-
[example | description | pointer to more information | …]<!-- optional -->
205
-
206
-
* Good, because it handle the most common use case: string property values
207
-
* Good, because all property values are grouped together
208
-
* Good, because it's less verbose
209
-
* Bad, because it doesn't handle non-string property values
210
-
211
-
### [option 2]
212
-
213
-
* Good, because it supports all use cases
214
-
* Bad, because properties are not naturally grouped together
215
-
* Bad, because it's quite verbose
216
-
* Bad, because we have no precedent for a keyword which explicitly defines its own properties. This would be new operational functionality, which we try to avoid if we can.
217
-
218
-
### [option 3]
219
-
220
-
* Good, because it supports all use cases
221
-
* Good, because all property values are grouped together
222
-
* Bad, because it's quite verbose
223
-
* Bad, because we have no precedent for a keyword which explicitly defines its own properties. This would be new operational functionality, which we try to avoid if we can.
224
-
225
-
### [option 4]
226
-
227
-
* Good, because it supports all use cases
228
-
* Bad, because properties are not naturally grouped together
229
-
* Bad, because it's very verbose
230
-
* Bad, because it introduces a lot of inter-keyword dependencies, which we'd have to exhaustively define
231
-
232
-
### [option 5]
233
-
234
-
* Good, because it supports all use cases
235
-
* Good, because it's a familiar syntax
236
-
* Bad, because properties are not naturally grouped together
237
-
* Bad, because it's very verbose
238
-
* Bad, because `ifProperties` is very niche. Will this spawn a new series of `if*` keywords? How would it interact with `if`?
239
-
240
-
### [option 6]
241
-
242
-
* Good, because it supports all use cases
243
-
* Bad, because it's an unintuitive syntax and easy to get wrong
244
-
* Bad, because properties are not naturally grouped together
245
-
246
-
## Links <!-- optional -->
247
-
248
-
*[Link type][Link to ADR]<!-- example: Refined by [ADR-0005](0005-example.md) -->
249
-
* … <!-- numbers of links can vary -->
250
-
251
-
252
229
## [Appendix] Problems With Existing Patterns {#problems}
0 commit comments