Commit 8ac3f22
committed
Update addError to give precedence to newly added schemas
HttpApiSchema.UnionUnify creates a union whose members are listed in the
order of `[...firstArgUnionMembers, ...secondArgUnionMembers]`. When
encoding a union, Schema will try each member in the order that they
appear.
So the `addError` method on each of the HttpApi* classes, by passing the
user-provided schema as a second argument, causes older schemas that
encompass newer schemas to take precedence over the newer ones.
By flipping the argument order, users are now able to use `addError`
with a schema that (partly) encompasses an older one, to override the
encoding behaviour of value conforming to that schema.1 parent f60dce6 commit 8ac3f22
File tree
3 files changed
+4
-4
lines changed- packages/platform/src
3 files changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
188 | 187 | | |
189 | 188 | | |
190 | | - | |
| 189 | + | |
| 190 | + | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
771 | 771 | | |
772 | 772 | | |
773 | 773 | | |
| 774 | + | |
774 | 775 | | |
775 | | - | |
776 | 776 | | |
777 | 777 | | |
778 | 778 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
| 310 | + | |
310 | 311 | | |
311 | | - | |
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| |||
0 commit comments