Skip to content

Conversation

@stephenplusplus
Copy link
Contributor

Fixes #368

Looks like there are two concepts of metadata in an Object response (seen here),

  1. metadata, such as etag, selfLink, contentType, updated, kind, id, etc.
  2. custom metadata, embedded within metadata.metadata

This PR fixes the way in which the insert API receives the request body from us , so that custom properties can be set as we say they are during a file upload.

However, that would stop a user from specifying other, non-custom, metadata properties. Maybe we should just change the docs to say "custom metadata properties go inside a metadata object", e.g.

var options = {
  metadata: {
    contentType: 'content-type',
    metadata: {
      custom: 'metadata'
    }
  }
}

bucket.upload("/file/path.txt", options, //...

bucket.file("file.txt").createWriteStream(options)

I'm talking myself out of thinking this PR is a good idea. Halp!

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 2, 2015
@stephenplusplus stephenplusplus force-pushed the spp--storage-stream-metadata branch from 89b74b0 to d144998 Compare February 2, 2015 17:05
@stephenplusplus stephenplusplus added the api: storage Issues related to the Cloud Storage API. label Feb 2, 2015
@ryanseys
Copy link
Contributor

ryanseys commented Feb 2, 2015

metadata.metadata is annoying but that's how it's documented :(

Maybe we should just change the docs to say "custom metadata properties go inside a metadata object"

Yes. They also can know this from just reading the docs. The outer "metadata" is actually just request body in this case so maybe we can clarify this when we change the docs. One is "User-provided metadata" and the other is "Google provided metadata" (???) I think that might help, but yeah, annoying.

@dhermes
Copy link
Contributor

dhermes commented Feb 2, 2015

I'm quite interested in what you decide. We (gcloud-python) currently have a property for each key in the dictionary and I am debating just throwing it out and using the dictionary as-is.

The metadata.metadata concept makes me sad all day, but the API is "set in stone" at this point.

@ryanseys
Copy link
Contributor

ryanseys commented Feb 2, 2015

So wait, what other properties go on the same level as the outer metadata object as seen at #368 (comment) ?

@stephenplusplus
Copy link
Contributor Author

I believe we should keep things as-is (close this PR). metadata.metadata is a bit silly, but if that's what the API wants, I don't think we can get around it.

@ryanseys
Copy link
Contributor

ryanseys commented Feb 4, 2015

Agreed. Is that what this PR aims to accomplish right now?

@stephenplusplus
Copy link
Contributor Author

Yeah, it just unboxed the metadata = { metadata: {} } object to send just the custom part. I thought it was a bug I was fixing, but it's just a quirk.

@wong2
Copy link

wong2 commented Oct 28, 2015

ha, it wasted me hours to figure out the silly file.setMetadata({metadata: {}}, ...) api

@jgeewax
Copy link
Contributor

jgeewax commented Oct 28, 2015

Hey @wong2 : Can you help us understand what we could've done different to avoid wasting time?

@wong2
Copy link

wong2 commented Oct 28, 2015

@jgeewax sorry for my previous impolite comment, you've documented it, it's my fault for not noticing it.

@jgeewax
Copy link
Contributor

jgeewax commented Oct 28, 2015

@wong2 No problem at all -- just wanted to make sure make sure it wasn't something we could make better ! :)

@wong2
Copy link

wong2 commented Oct 28, 2015

@jgeewax maybe you can add a more obvious notice aboout this in the document?

chingor13 pushed a commit that referenced this pull request Aug 22, 2022
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/4bdc1826-2f69-49f1-a63b-94f99cceb5ee/targets

- [ ] To automatically regenerate this PR, check this box.

Source-Link: googleapis/synthtool@89d431f
sofisl pushed a commit that referenced this pull request Sep 27, 2022
sofisl pushed a commit that referenced this pull request Oct 12, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [ts-loader](https://togithub.com/TypeStrong/ts-loader) | devDependencies | major | [`^7.0.0` -> `^8.0.0`](https://renovatebot.com/diffs/npm/ts-loader/7.0.5/8.0.0) |

---

### Release Notes

<details>
<summary>TypeStrong/ts-loader</summary>

### [`v8.0.0`](https://togithub.com/TypeStrong/ts-loader/blob/master/CHANGELOG.md#v800)

[Compare Source](https://togithub.com/TypeStrong/ts-loader/compare/v7.0.5...v8.0.0)

-   [Support for symlinks in project references](https://togithub.com/TypeStrong/ts-loader/pull/1136) - thanks [@&#8203;sheetalkamat](https://togithub.com/sheetalkamat)!
-   `ts-loader` now supports TypeScript 3.6 and greater **BREAKING CHANGE**

</details>

---

### Renovate configuration

:date: **Schedule**: "after 9am and before 3pm" (UTC).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-bigquery-data-transfer).
sofisl pushed a commit that referenced this pull request Oct 12, 2022
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
sofisl pushed a commit that referenced this pull request Oct 13, 2022
- [ ] Regenerate this pull request now.

Committer: @summer-ji-eng
PiperOrigin-RevId: 434859890

Source-Link: googleapis/googleapis@bc2432d

Source-Link: googleapis/googleapis-gen@930b673
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTMwYjY3MzEwM2U5MjUyM2Y4Y2ZlZDM4ZGVjZDdkM2FmYWU4ZWJlNyJ9
sofisl pushed a commit that referenced this pull request Oct 13, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [ts-loader](https://togithub.com/TypeStrong/ts-loader) | devDependencies | major | [`^7.0.0` -> `^8.0.0`](https://renovatebot.com/diffs/npm/ts-loader/7.0.5/8.0.0) |

---

### Release Notes

<details>
<summary>TypeStrong/ts-loader</summary>

### [`v8.0.0`](https://togithub.com/TypeStrong/ts-loader/blob/master/CHANGELOG.md#v800)

[Compare Source](https://togithub.com/TypeStrong/ts-loader/compare/v7.0.5...v8.0.0)

-   [Support for symlinks in project references](https://togithub.com/TypeStrong/ts-loader/pull/1136) - thanks [@&#8203;sheetalkamat](https://togithub.com/sheetalkamat)!
-   `ts-loader` now supports TypeScript 3.6 and greater **BREAKING CHANGE**

</details>

---

### Renovate configuration

:date: **Schedule**: "after 9am and before 3pm" (UTC).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-bigquery-data-transfer).
sofisl pushed a commit that referenced this pull request Nov 9, 2022
sofisl pushed a commit that referenced this pull request Nov 30, 2022
* fix: change datacatalog resource name config 

PiperOrigin-RevId: 464572702

Source-Link: googleapis/googleapis@9f82a84

Source-Link: googleapis/googleapis-gen@31de1ae
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzFkZTFhZTU0MGI3NWYxOWFhMGRiZmM1ZTBiMDFjNGI1ZjUxNDhjZCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
GautamSharda pushed a commit that referenced this pull request Jan 14, 2026
GautamSharda pushed a commit that referenced this pull request Jan 15, 2026
sofisl pushed a commit that referenced this pull request Jan 27, 2026
sofisl pushed a commit that referenced this pull request Jan 27, 2026
sofisl pushed a commit that referenced this pull request Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow setting of custom metadata

6 participants