google-apis-rs / generator

A binding and CLI generator for all google APIs
Apache License 2.0
71 stars 14 forks source link

Skip serializing if value is empty #14

Closed binarybana closed 4 years ago

binarybana commented 4 years ago

I'm hitting problems when using the generated storage APIs. It looks like the default behavior is to serialize all fields of the schema with null JSON values in the body, but I've found that Google storage APIs don't consider this valid (see eg the api explorer )

It seems like the default serde annotation on these fields should be #[serde(default,skip_serializing_if = "Option::is_none")] instead of just default. And indeed, that enables my tests on both storage and pubsub to pass.

Byron commented 4 years ago

Thanks a lot :)! This may well be the first PR this project has ever received, a milestone so to say!

binarybana commented 4 years ago

My pleasure! What makes it even better is I think this is my first upstream contribution in Rust and my first in a few years!