-
-
Couldn't load subscription status.
- Fork 126
fix(api): support filtering with comma-separated values in rest handler #1620
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
Conversation
WalkthroughWalkthroughThe recent changes enhance the Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- packages/server/src/api/rest/index.ts (1 hunks)
- packages/server/tests/api/rest.test.ts (1 hunks)
Additional comments not posted (2)
packages/server/src/api/rest/index.ts (1)
1537-1546: Ensure correct handling of comma-separated values in filters.The updated logic correctly splits the value string by commas, filters out empty entries, and coerces the values. The return statements handle cases with multiple values and single values appropriately.
packages/server/tests/api/rest.test.ts (1)
371-380: LGTM! Ensure the new functionality is covered across the codebase.The test case correctly verifies the multi-ID filtering functionality. The code changes are approved.
However, ensure that the new functionality is covered across the codebase.
Verification successful
The multi-ID filtering functionality is well-covered across the codebase.
The search results indicate that the
filter[id]query parameter is tested in multiple test files and is also present in the OpenAPI plugin file. This confirms that the new functionality is adequately covered.
packages/server/tests/api/rest.test.tspackages/server/tests/adapter/sveltekit.test.tspackages/server/tests/adapter/fastify.test.tspackages/server/tests/adapter/express.test.tspackages/plugins/openapi/src/rest-generator.tsScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the new multi-ID filtering functionality. # Test: Search for the function usage. Expect: Occurrences of the new functionality. rg --type typescript -A 5 $'filter[id]=user1,user2'Length of output: 87
Script:
#!/bin/bash # Description: Verify the usage of the new multi-ID filtering functionality. # Test: Search for the function usage. Expect: Occurrences of the new functionality. rg --type ts -A 5 'filter\[id\]=user1,user2'Length of output: 46
Script:
#!/bin/bash # Description: Verify the usage of the new multi-ID filtering functionality. # Test: Search for the function usage. Expect: Occurrences of the new functionality. rg --type ts -A 5 'filter\[id\]'Length of output: 6000
Fixes #1573