Skip to content

Commit be9840c

Browse files
committed
listable: Fix incorrect unmarshaling of null to []T{null}
1 parent aa7d254 commit be9840c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

common/json/badoption/listable.go

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ func (l Listable[T]) MarshalJSONContext(ctx context.Context) ([]byte, error) {
1818
}
1919

2020
func (l *Listable[T]) UnmarshalJSONContext(ctx context.Context, content []byte) error {
21+
if string(content) == "null" {
22+
return nil
23+
}
2124
var singleItem T
2225
err := json.UnmarshalContextDisallowUnknownFields(ctx, content, &singleItem)
2326
if err == nil {

0 commit comments

Comments
 (0)