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 !
Hi,
When trying to use a rest api method's param that supports repeated values (i.e.
Vec<T>), it fails at runtime asreqwestexpects 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_idsof typeVec<String>, it is passed as-is toreqwestquery: https://github.com/google-apis-rs/generated/blob/master/gen/gmail/v1/lib/src/lib.rs#L8537I tried to dig down on how the generator generates the method. As I understand it, it would need to remap repeated parameters to
reqwestexpected format in here:generator/google_rest_api_generator/src/method_builder.rs
Line 368 in a848301
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 !