Skip to content

Preserve nullable named objects in gRPC collections - #4071

Merged
raphael merged 1 commit into
v3from
preserve-nullable-named-collection-items
Oct 23, 2026
Merged

raphael merged 1 commit into
v3from
preserve-nullable-named-collection-items

Conversation

@raphael

@raphael raphael commented Oct 23, 2026

Copy link
Copy Markdown
Member

Goa's generated gRPC converters can panic when an ArrayOf or MapOf contains a null entry for a named object. These entries are valid for nullable collections, but the loops pass nil to private object conversion helpers that require a present object. Inline object collections already preserve these entries in their loops.

The generated loops now keep nullable array positions and map keys before calling an object helper, in both conversion directions. ArrayOfRequired still rejects nil entries, and strict helper bodies and required object or union validation are unchanged. This preserves in-memory conversion behavior: binary protobuf still decodes nil message entries as present empty messages, and ProtoJSON still rejects null entries.

Generated request and response tests cover populated values around a nil entry, objects with a required union, present empty objects, required-element rejection, and the existing wire behavior. The gRPC generator package tests, focused generator tests with the race detector, and configured lint checks passed with Go 1.27.3.

@raphael
raphael merged commit 12a5635 into v3 Oct 23, 2026
5 checks passed
@raphael
raphael deleted the preserve-nullable-named-collection-items branch October 23, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant