Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renderURLSearchParams doesn't render BoolValue and other well-known wrapper types correctly #49

Open
seanami opened this issue Mar 21, 2023 · 2 comments

Comments

@seanami
Copy link

seanami commented Mar 21, 2023

I have a request message with google.protobuf.BoolValue name = 1 as a field. When I define a value for this field in Typescript like name: { value: false }, then I see that the request made by the generated code does not include the parameter for this field.

It appears that renderURLSearchParams strips out all primitive types with zero values, but that's not expected for BoolValue, since the whole point is to be able to differentiate between false and nil.

Is there an established way to fix issues like this within this library? I see #25 and cresta#1, but it doesn't include BoolValue or the other wrapper well-known types.

@seanami
Copy link
Author

seanami commented Mar 22, 2023

Same problem occurs with StringValue and the other wrapper types as well. The zero values are removed rather than serialized.

@seanami seanami changed the title renderURLSearchParams doesn't render BoolValue well-known type correctly renderURLSearchParams doesn't render BoolValue and other well-known wrapper types correctly Mar 22, 2023
@seanami
Copy link
Author

seanami commented Mar 24, 2023

I opened a PR with a fix for this issue to further the discussion here: #50

This is code that we're already using in our own project via a fork, but it would be nice to get it back into main if possible.

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

No branches or pull requests

1 participant