Repository navigation
Commit 0625f64
api: fix related field API incompatibility in /patches
In Patchwork 3.x, in API versions above 1.1, the related field
of /patches is always an array. It is not present at all in API
version 1.1.
In Patchwork 4.0, the field is null in 1.1, and is an array in later API
versions.
Adding the omitempty tag causes the field to disappear from 1.1, but
then it's either an array or not present if empty in 1.4.
Make the API more compatible with Patchwork 3.x by changing the field
into a pointer to a slice, adding the omitzero tag, and always
explicitly allocating an empty slice (&nil != &[]string{}) for /patches
responses.
Signed-off-by: Franciszek Stachura <fbstachura@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>1 parent 63f07d0 commit 0625f64
2 files changed
Lines changed: 4 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
| 367 | + | |
367 | 368 | | |
368 | 369 | | |
369 | 370 | | |
| |||
378 | 379 | | |
379 | 380 | | |
380 | 381 | | |
381 | | - | |
| 382 | + | |
382 | 383 | | |
383 | 384 | | |
384 | 385 | | |
| |||
405 | 406 | | |
406 | 407 | | |
407 | 408 | | |
408 | | - | |
| 409 | + | |
409 | 410 | | |
410 | 411 | | |
411 | 412 | | |
| |||
419 | 420 | | |
420 | 421 | | |
421 | 422 | | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | 423 | | |
426 | 424 | | |
427 | 425 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
0 commit comments