Skip to content
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

feat: add includeFoldersAsPrefixes for managed folders #2413

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

ddelgrosso1
Copy link
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #2384 🦕

@ddelgrosso1 ddelgrosso1 requested review from a team as code owners February 28, 2024 15:57
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: storage Issues related to the googleapis/nodejs-storage API. labels Feb 28, 2024
@ddelgrosso1 ddelgrosso1 added the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 28, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 28, 2024
@ddelgrosso1
Copy link
Contributor Author

There are some assumptions baked into the paginator dependency. The biggest issue is that paginator assumes only a single return value whereas getFiles returns not only File objects but the raw response. In order to access prefixes on the raw response autoPaginate must be set to false.

Fixing this in paginator is not a straightforward process and would likely break other libraries.

@ddelgrosso1 ddelgrosso1 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 28, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 28, 2024
@@ -3129,6 +3129,20 @@ describe('storage', () => {
assert.strictEqual(files!.length, NEW_FILES.length);
});

it('returns folders as prefixes when includeFoldersAsPrefixes is set', async () => {
const expected = [`${DIRECTORY_NAME}/`];
const [, , result] = await bucket.getFiles({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't confirm a specific managed folder is in the list of prefixes; It might be the best we can do right now though because you'd need to make a one-off request to create a managed folder through Apiary Node.js client to verify functionality.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By apiary you mean storage control?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there's support in Storage v1 json apiary that has CreateManagedFolder RPC which would help with this test until Storage Control is available.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably beyond the scope of this change to start pulling in other dependencies just for a single test case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When do we plan on adding the create functionality in this library?

@ddelgrosso1 ddelgrosso1 merged commit 3044d3c into googleapis:main Mar 7, 2024
16 checks passed
@ddelgrosso1 ddelgrosso1 deleted the managed-folders branch March 7, 2024 19:41
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 googleapis/nodejs-storage API. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Support for includeFolders option in ListObjects
5 participants