Skip to content

fix(gengateway): use pointer for bodyData in OpaqueAPI PATCH requests#6246

Merged
johanbrandhorst merged 4 commits intogrpc-ecosystem:mainfrom
kop:use_opaque_api_generates_invalid_code
Jan 18, 2026
Merged

fix(gengateway): use pointer for bodyData in OpaqueAPI PATCH requests#6246
johanbrandhorst merged 4 commits intogrpc-ecosystem:mainfrom
kop:use_opaque_api_generates_invalid_code

Conversation

@kop
Copy link
Copy Markdown
Contributor

@kop kop commented Jan 15, 2026

When generating code for the OpaqueAPI with a PATCH request that includes a FieldMask, the generated code incorrectly declared bodyData as a value type. This caused a compilation error when passing it to the SetXXX method, which expects a pointer for message types.

This change updates the templates to declare bodyData as a pointer and decode directly into it.

Additionally, extended examples/internal/proto/examplepb/opaque.proto with an OpaqueUpdateProduct method to serve as a test and reproduction case for this scenario.

Fixes: #6234

kop added 3 commits January 15, 2026 21:08
When generating code for the OpaqueAPI with a PATCH request that includes a FieldMask, the generated code incorrectly declared `bodyData` as a value type. This caused a compilation error when passing it to the `SetXXX` method, which expects a pointer for message types.

This change updates the templates to declare `bodyData` as a pointer and decode directly into it.

Additionally, extended `examples/internal/proto/examplepb/opaque.proto` with an `OpaqueUpdateProduct` method to serve as a test and reproduction case for this scenario.
@kop kop marked this pull request as ready for review January 15, 2026 19:33
Comment thread protoc-gen-grpc-gateway/internal/gengateway/template.go Outdated
@johanbrandhorst johanbrandhorst merged commit d121390 into grpc-ecosystem:main Jan 18, 2026
14 checks passed
@johanbrandhorst
Copy link
Copy Markdown
Collaborator

Thank you!

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.

use_opaque_api generates invalid code

2 participants