Skip to content

feat(protogen): generate oneof case accessors and group clear - #365

Merged
adamw7 merged 1 commit into
mainfrom
claude/new-feature-ideas-suvmu9
Jul 10, 2026
Merged

feat(protogen): generate oneof case accessors and group clear#365
adamw7 merged 1 commit into
mainfrom
claude/new-feature-ideas-suvmu9

Conversation

@adamw7

@adamw7 adamw7 commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Teach the builder generator to handle protobuf oneof groups. For each
real oneof (proto3 synthetic oneofs backing optional fields are
excluded via getRealOneofs()), the generated optional interface and
builder now expose:

  • getXxxCase() returning protobuf's generated XxxCase enum, so the
    selected member is inspectable through the fluent builder chain
  • clearXxx() that resets the whole group

Member setters/hasXxx()/clearXxx() were already emitted since oneof
members carry presence; this adds the group-level discriminator and
clear. Refactors the field clear/declareClear helpers into name-based
variants reused by the oneof methods.

Adds a Payment oneof message to the proto3 test proto and integration
tests covering case discrimination and group clear, and updates
README/AGENTS docs.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01BNGeaXZiMQ98UUCBi1yKgi

Teach the builder generator to handle protobuf `oneof` groups. For each
real oneof (proto3 synthetic oneofs backing `optional` fields are
excluded via getRealOneofs()), the generated optional interface and
builder now expose:

- `getXxxCase()` returning protobuf's generated `XxxCase` enum, so the
  selected member is inspectable through the fluent builder chain
- `clearXxx()` that resets the whole group

Member setters/hasXxx()/clearXxx() were already emitted since oneof
members carry presence; this adds the group-level discriminator and
clear. Refactors the field clear/declareClear helpers into name-based
variants reused by the oneof methods.

Adds a Payment oneof message to the proto3 test proto and integration
tests covering case discrimination and group clear, and updates
README/AGENTS docs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BNGeaXZiMQ98UUCBi1yKgi
@adamw7
adamw7 merged commit 300505c into main Jul 10, 2026
4 checks passed
@adamw7
adamw7 deleted the claude/new-feature-ideas-suvmu9 branch July 10, 2026 08:59
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.

2 participants