Skip to content

Commit 4374400

Browse files
committed
update propertyDependencies ADR
1 parent c566004 commit 4374400

File tree

1 file changed

+31
-54
lines changed

1 file changed

+31
-54
lines changed

proposals/propertyDependencies-adr.md

+31-54
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [short title of solved problem and solution]
1+
# Add New Keyword: `propertyDependencies`
22

33
* Status: proposed
44
* Deciders: @gregsdennis, @jdesrosiers, @relequestual
@@ -64,6 +64,11 @@ that concept to solve this problem.
6464
}
6565
```
6666

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+
6772
### Option 2
6873

6974
This version uses an array of objects. Each object is a collection of the
@@ -89,6 +94,11 @@ prone.
8994
}
9095
```
9196

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+
92102
### Option 3
93103

94104
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.
111121
}
112122
```
113123

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+
114129
### Option 4
115130

116131
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.
133148
}
134149
```
135150

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
137157

138158
This one is a variation of `if` that combines `if`, `properties`, and `required`
139159
to reduce boilerplate. It's also essentially a variation of the previous example
@@ -159,6 +179,12 @@ verbose.
159179
}
160180
```
161181

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+
162188
### Option 6
163189

164190
All of the previous alternatives use a schema as the discriminator. This
@@ -178,6 +204,9 @@ intuitive as the chosen solution.
178204
}
179205
```
180206

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
181210

182211
## Decision Outcome
183212

@@ -197,58 +226,6 @@ cases carried a lower priority.
197226
- Properties with non-string values cannot be supported using this keyword and
198227
the `allOf`-`if`-`then` pattern must still be used.
199228

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-
252229
## [Appendix] Problems With Existing Patterns {#problems}
253230

254231
### `oneOf`/`anyOf`

0 commit comments

Comments
 (0)