ThouCheese / cloud-storage-rs

A crate for uploading files to Google cloud storage, and for generating download urls.
MIT License
124 stars 87 forks source link

Deserialization errors #106

Open chrisboyce opened 2 years ago

chrisboyce commented 2 years ago

It appears that the serde attributes for at least some of the structs don't match what GCP is actually returning. For instance, a bucket has a StorageClass of "ARCHIVE" which is not in the StorageClass enum. I'm happy to add missing items as a PR, but is there a canonical source for the schema (specifically with regards to whether and item is an Option)? I haven't been able to find one, but I'm reluctant to start making a bunch of fields optional, such as the cors field.

ThouCheese commented 2 years ago

No I haven't been able to find a truly comprehensive source that explains which fields are required and which are not, so the current implementation is on a best-effort basis. If this is causing bugs for you in practice then please do submit a PR that fixes the errors that you run into, I'd be happy to accept it.

mattwowza commented 2 years ago

It seems google has removed the field "timeDeleted" from the response so the response fails to deserialize into an "Object". The solution to this general problem is to not make any fields required and allow unknown fields to not fail either.