gRPC & RPC

Protobuf Oneof

A protobuf feature where only one field in a group can be set at a time, useful for polymorphic message types and variant responses. Setting any field in a oneof automatically clears all other fields in the group. Oneof fields save memory because the runtime only allocates storage for the active variant. They are commonly used for union types, discriminated response payloads, and API design patterns that return different result shapes.

البروتوكولات ذات الصلة

انظر أيضًا