-
Notifications
You must be signed in to change notification settings - Fork 370
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
Add typing for File.metadata
#1817
Comments
Hi @anantakrishna , This is done on purpose. We don't believe it is good practice to validate the data returned by the server. The way this is currently implemented, the data returned by the server gets propagated to you without being processed in any way. This is safer from bugs on our end because if Cloud Storage changes/adds metadata fields, consumers of this library will get those changes without the current version of the library breaking and/or having to upgrade versions. |
Thank you @shaffeeullah for explanation. I partly agree with this logic, however not fully. Let me explain further.
I hope now the background of my inquiry is clearer. |
Hi @anantakrishna while I agree that these are strong advantages of including typing for
|
@shaffeeullah is this still the case if you use fallback index types? |
Hi @fmmoret , This is a fair suggestion. We will consider implementing this. It isn't a breaking change and will allow users to access new GCS metadata fields without upgrading the library. |
For my part, being able to access the generation number of the file has value, and since generation number is housed under metadata, it would be nice to have a type contract, or to have generation number live elsewhere even. |
Fixed via #2234 |
Environment details
@google-cloud/storage
version: 5.18.2Steps to reproduce
File
class.metadata
property in TypeScript.The issue is that its type is effectively …
any
, whereas the reference and example demonstrate the structure of the metadata.Why not to add this structure to the typing?
The text was updated successfully, but these errors were encountered: