Skip to content

Add comment to explain broken codegen - #307

Merged
chrsmith merged 1 commit into
mainfrom
chrsmith/add-interceptor-comment
Aug 19, 2026
Merged

Add comment to explain broken codegen#307
chrsmith merged 1 commit into
mainfrom
chrsmith/add-interceptor-comment

Conversation

@chrsmith

Copy link
Copy Markdown
Contributor

What changed?

This PR just adds a comment inside the Golang text template used for generating the Payload visiting interceptor (proxy/interceptor.go).

Why?

If you add a field with type commonpb.Payload inside of a oneof { ... } block, the interceptor will generate bad code. (You'll get a compiler error that it is trying to assign a value to an undefined field.)

This is by design, in that the way you need to treat protobuf fields wrapped in a oneof block is a little different. You can read the field, but you cannot write it. You need to wrote to the oneof-field instead.

This is not at all obvious to the uninitiated, and just seems confusing. It's easy enough to look at cmd/proxygenerator/interceptor.go and see that you need to copy the custom logic, but hopefully this comment will explain the situation.

How did you test it?

Ran make, nothing set file.

Potential risks

None.

@chrsmith
chrsmith requested review from a team as code owners August 19, 2026 17:15
@chrsmith
chrsmith merged commit cfec6ae into main Aug 19, 2026
4 checks passed
@chrsmith
chrsmith deleted the chrsmith/add-interceptor-comment branch August 19, 2026 17:35
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