Setting metadata seems really difficult to reason with.
See original GitHub issueI was just trying to set the metadata to files and frankly couldn’t figure out what was going on. I’m still not 100% but I think this invalid:
file.setMetadata({
'example-key': 'example-value',
});
Instead it’s meant to be:
file.setMetadata({
metadata: {
'example-key': 'example-value',
}
});
Reason being that custom metadata has to moved out of the top level set of metadata values.
If this is the case, I would love two changes made to the API to make this easy to reason with:
- Enforce a strict check on the metadata value such that custom values cannot be used on the top level metadata object.
- Bit of a stretch but I would like it Add a setCustomMetadata() method to avoid this weirdness around wrapping metadata with a metadata key.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Ten Most Common Metadata Errors - WV GIS Technical Center
Metadata experts have joined together to compile this list of common errors that are typically made when people create metadata records.
Read more >Fixing common Metadata API errors for more ... - YouTube
One of the most time-consuming frustrations you'll face as a Salesforce admin, developer, or architect are deployments that repeatedly fail.
Read more >How to display full metadata in ArcGIS Online open data
I have gone through the metadata setting on our organization's setting page and none of the options appears allow the display of the...
Read more >Common Mistakes Companies Make with Metadata ...
Difficulty in accessing the metadata repository : If data access and retrieval requires too much effort, it defeats the purpose of metadata management....
Read more >Metadata Matters: Connecting People and Information
Metadata provides a means of indexing, accessing, preserving, and discovering ... database into a single ranked result set is difficult and time consuming....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I ran into this recently, and would suggest that rather than changing the APIs maybe just add an explicit user metadata sample for any of the contexts that support it? It’s very loosely hinted at in some of the existing samples such as https://github.com/googleapis/nodejs-storage/blob/master/samples/files.js#L257
The docs do touch on this as well (https://googleapis.dev/nodejs/storage/latest/File.html#setMetadata), but don’t explicitly call out that the nested nature of the term ‘metadata’ might be a gotcha for those unfamiliar with this. Perhaps some clearer wording to suggest that
metadata.metadata
can be considered asmetadata.user_metadata
ormetadata.context_metadata
, rather than GCS-specific metadata would help?I’d also suggest that this
file.js
example that is embedded in the docs could be included in the samples directory for those of us who read docs as a last resort 😃 This code most clearly illustrates the difference between reserved GCS properties and custom properties.It’s rare a complaint for this comes up, and since we’re stuck for ideas, maybe it’s just an uncommon, short-lived pain point?