-
Notifications
You must be signed in to change notification settings - Fork 894
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
[workspace]feat: validate workspace when find objects #8268
[workspace]feat: validate workspace when find objects #8268
Conversation
Signed-off-by: SuZhou-Joe <[email protected]>
Signed-off-by: SuZhou-Joe <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #8268 +/- ##
==========================================
+ Coverage 64.04% 64.11% +0.07%
==========================================
Files 3740 3744 +4
Lines 88582 88857 +275
Branches 13791 13852 +61
==========================================
+ Hits 56731 56974 +243
- Misses 31253 31270 +17
- Partials 598 613 +15
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
src/plugins/workspace/server/saved_objects/workspace_id_consumer_wrapper.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: SuZhou-Joe <[email protected]>
src/plugins/workspace/server/saved_objects/workspace_id_consumer_wrapper.ts
Outdated
Show resolved
Hide resolved
src/plugins/workspace/server/saved_objects/workspace_id_consumer_wrapper.ts
Outdated
Show resolved
Hide resolved
); | ||
: this.formatWorkspaceIdParams(wrapperOptions.request, options); | ||
if (finalOptions.workspaces?.length) { | ||
const workspaceList = await this.workspaceClient.list( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we simply call wrapperOptions.client.find
with WORKSPACE_TYPE
to get the the workspace list? Just thinking might be better to not introduce another dependency to saved object client wrapper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can not because workspace is a hidden type.
Signed-off-by: SuZhou-Joe <[email protected]>
Signed-off-by: SuZhou-Joe <[email protected]>
* feat: validate workspace when find objects Signed-off-by: SuZhou-Joe <[email protected]> * Changeset file for PR #8268 created/updated * fix: type error Signed-off-by: SuZhou-Joe <[email protected]> * feat: add unit test Signed-off-by: SuZhou-Joe <[email protected]> * feat: address some comments Signed-off-by: SuZhou-Joe <[email protected]> * feat: optimize performance Signed-off-by: SuZhou-Joe <[email protected]> --------- Signed-off-by: SuZhou-Joe <[email protected]> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> (cherry picked from commit b6eb1a0) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* feat: validate workspace when find objects * Changeset file for PR #8268 created/updated * fix: type error * feat: add unit test * feat: address some comments * feat: optimize performance --------- (cherry picked from commit b6eb1a0) Signed-off-by: SuZhou-Joe <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
…ject#8268) (opensearch-project#8431) * feat: validate workspace when find objects * Changeset file for PR opensearch-project#8268 created/updated * fix: type error * feat: add unit test * feat: address some comments * feat: optimize performance --------- (cherry picked from commit b6eb1a0) Signed-off-by: SuZhou-Joe <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Description
We need to validate the workspace ids users pass, if it is not valid, we should just throw a 400 error and save the resource of our search engine.
Issues Resolved
Screenshot
Testing the changes
Changelog
Check List
yarn test:jest
yarn test:jest_integration