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

Support using protobuf types in query parameters #306

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zaquestion
Copy link
Member

Useful for passing dates in the query

@zaquestion
Copy link
Member Author

Honestly I think a lot of this json unmarshaling in the query stuff is going to be up for the chopping block in v1

@zaquestion
Copy link
Member Author

This need to wait for

singlePBTypeUnmarshalTmpl := `
var {{.LocalName}} *{{.GoType}}
{{.LocalName}} = &{{.GoType}}{}
err = jsonpb.UnmarshalString({{.LocalName}}Str, {{.LocalName}})`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of creating thses tailored decode functions for each individual field, how about we we first merge all the variables from path, query, and body into a single JSON string, then call jsonpb.Unmarshal(s, req) to decode into the request struct in one go? Seems like it would simplify the decode logic significantly?

@toctan
Copy link
Contributor

toctan commented Nov 6, 2020

This is great! We need this to use the FieldMask update_mask field in the standard update method: https://cloud.google.com/apis/design/standard_methods#update

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