-
Notifications
You must be signed in to change notification settings - Fork 28
validate group and sort by #254
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
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |

TL;DR
Added field validation for GroupBy and SortBy parameters in API requests to prevent invalid queries.
What changed?
EntityColumnsmap that defines valid columns for blocks, transactions, logs, transfers, balances, and tracesValidateGroupByAndSortByfunction to check if fields are valid entity columns or aggregate function aliasesHow to test?
Test valid requests with proper GroupBy and SortBy fields:
Test invalid requests with improper fields to verify error handling:
Should return a 400 Bad Request with a descriptive error message
Test requests with aggregate functions and aliases:
Why make this change?
This validation prevents users from submitting queries with invalid fields, which could lead to SQL errors or unexpected behavior. By validating input parameters early in the request lifecycle, we can provide clear error messages to API consumers and prevent potential security issues from malformed queries. The validation also supports aggregate function aliases, making the API more flexible for analytical queries.