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

Repeated method parameters not working #29

Open
appaquet opened this issue Sep 11, 2020 · 4 comments
Open

Repeated method parameters not working #29

appaquet opened this issue Sep 11, 2020 · 4 comments

Comments

@appaquet
Copy link

Hi,

When trying to use a rest api method's param that supports repeated values (i.e. Vec<T>), it fails at runtime as reqwest expects repeated fields to be passed in a &[(param, value1), (param, value2)] format instead of &[(param, values)] format (see reqwest's request.rs).

Example: In Gmail's list threads request, for parameter label_ids of type Vec<String>, it is passed as-is to reqwest query: https://github.com/google-apis-rs/generated/blob/master/gen/gmail/v1/lib/src/lib.rs#L8537

I tried to dig down on how the generator generates the method. As I understand it, it would need to remap repeated parameters to reqwest expected format in here:

fn request_method<'a>(http_method: &str, params: impl Iterator<Item = &'a Param>) -> TokenStream {

Let me know if you need more info. I'm willing to take a stab at it if you can describe how you envision the fix.

Thanks !

@ggriffiniii
Copy link
Contributor

Thanks for the report. You're correct about the location in the generator that needed to be fixed. 9ad1f06 should have the fix. @mwilliammyers Would you mind regenerating the bindings whenever you get a chance?

@mwilliammyers
Copy link
Member

I tried generating it again but ran into some issues, so I will try again later when I have more time to fix the issues.

@doivosevic
Copy link

Hey guys! Any progress on this?

@mwilliammyers
Copy link
Member

mwilliammyers commented Mar 19, 2021

@doivosevic Sorry for the late response, I updated them all in google-apis-rs/generated@318cd3b1. All of the libs build, but many of the CLI bins do not.

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

4 participants