Commit bb87db2
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 ec6cb5d commit bb87db2
File tree
3 files changed
+6
-6
lines changed- packages/platform/src
3 files changed
+6
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
180 | 179 | | |
181 | 180 | | |
182 | | - | |
| 181 | + | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
697 | 697 | | |
698 | 698 | | |
699 | 699 | | |
700 | | - | |
701 | 700 | | |
702 | 701 | | |
703 | 702 | | |
704 | 703 | | |
705 | | - | |
| 704 | + | |
| 705 | + | |
706 | 706 | | |
707 | 707 | | |
708 | 708 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
310 | | - | |
311 | 310 | | |
312 | 311 | | |
313 | | - | |
| 312 | + | |
| 313 | + | |
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
| |||
0 commit comments