orEmpty coalesces a nil slice of any element type to an empty slice so the JSON renders as [] rather than null (A-3). Pair with `nullable:"false"` on the field so the spec and the runtime agree.
(s []T)
| 707 | // JSON renders as [] rather than null (A-3). Pair with `nullable:"false"` on |
| 708 | // the field so the spec and the runtime agree. |
| 709 | func orEmpty[T any](s []T) []T { |
| 710 | if s == nil { |
| 711 | return []T{} |
| 712 | } |
| 713 | return s |
| 714 | } |
no outgoing calls
no test coverage detected