Skip to content

sbe: Codec::New binds a message with a oneof field, which protowire-go refuses #141

Closed

Description

@bfrancojr

This port binds an SBE message that has a real oneof field, and protowire-go refuses it. Found while porting #132 (PR #140).

Go (encoding/sbe/template.go, since the initial release d137dd0) refuses a field in a non-synthetic oneof:

  • in a message: sbe: oneof field %s.%s not supported
  • in a composite: composite %s contains oneof field %s (wrapped by the caller, for example sbe: composite M.c: composite C contains oneof field f)
  • in a group entry: no check, so a oneof there binds in Go too.

A proto3 optional field sits in a synthetic oneof and is not refused.

C++ now (read from src/sbe/template.cc on the #140 branch, not measured): BuildTemplate and BuildCompositeFields have no oneof check, so such a message binds. Every member gets its own slot in the block, and Marshal writes all of them, unset members as zero.

Done when: Codec::New refuses a oneof member in a message and in a composite with Go's text, a proto3 optional field still binds, a group entry's oneof behaves as Go's does, and a test pins each case.

This narrows what binds, so the CHANGELOG should say so.

Activity

  1. added 5 commits that reference this issue on Nov 4, 2026
    e45944c
    db34ed3
    39e1261
    2ee007c
    674b935
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions