google-cloud-rust icon indicating copy to clipboard operation
google-cloud-rust copied to clipboard

Fields of `bytes` should be percent-encoded as query parameters

Open coryan opened this issue 8 months ago • 3 comments

To send query parameters of type "object" we serialize the object as JSON and send expand the parameters:

https://github.com/googleapis/google-cloud-rust/blob/0b3d43254520095682b9717643d0b37de218a371/generator/internal/rust/codec.go#L694-L702

The resulting code looks like so:

https://github.com/googleapis/google-cloud-rust/blob/0b3d43254520095682b9717643d0b37de218a371/src/generated/showcase/src/transport.rs#L115-L124

Consequently fields of type bytes are base64-encoded. Looking at how showcase works, it seems that these should be percent-encoded (which makes sense for query parameters).

coryan avatar May 17 '25 15:05 coryan

https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/delete#query-parameters

This makes me think gapic-showcase is wrong.

dbolduc avatar May 30 '25 16:05 dbolduc

And the proto specification is really bytes, not just a string:

https://cloud.google.com/iam/docs/reference/rpc/google.iam.admin.v1#google.iam.admin.v1.DeleteRoleRequest

coryan avatar May 30 '25 16:05 coryan

We should still clean this up, but it is not a bug in our code.

Blocked externally on: https://github.com/googleapis/gapic-showcase/issues/1593

dbolduc avatar May 30 '25 17:05 dbolduc