generator icon indicating copy to clipboard operation
generator copied to clipboard

Repeated method parameters not working

Open appaquet opened this issue 4 years ago • 4 comments

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: https://github.com/google-apis-rs/generator/blob/a848301466556f16d48df64ef16b92a8327a8406/google_rest_api_generator/src/method_builder.rs#L368

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 !

appaquet avatar Sep 11 '20 14:09 appaquet

Thanks for the report. You're correct about the location in the generator that needed to be fixed. https://github.com/google-apis-rs/generator/commit/9ad1f063e5046f2f404ea77f0116e0fd25b4246d should have the fix. @mwilliammyers Would you mind regenerating the bindings whenever you get a chance?

ggriffiniii avatar Sep 11 '20 22:09 ggriffiniii

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.

mwilliammyers avatar Sep 14 '20 18:09 mwilliammyers

Hey guys! Any progress on this?

doivosevic avatar Mar 10 '21 11:03 doivosevic

@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.

mwilliammyers avatar Mar 19 '21 06:03 mwilliammyers