-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
fix: support "Unsupported" type of fields in "@@index" #1902
Conversation
📝 WalkthroughWalkthroughThe changes primarily involve modifications to the Changes
Assessment against linked issues
Possibly related PRs
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 using PR comments)
Other keywords and placeholders
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
🧹 Outside diff range and nitpick comments (2)
tests/regression/tests/issue-1870.test.ts (2)
4-14
: LGTM! Consider adding more test cases.The test correctly validates the fix for issue #1870, allowing Unsupported types in @@index. However, consider adding more test cases to cover:
- Different Unsupported type variations
- Invalid index configurations
- Multiple indexes on the same Unsupported field
1-14
: Add documentation comments.Consider adding JSDoc comments to explain:
- The purpose of this regression test
- The connection to issue [Feature Request] Allow Unsupported field types in @@index #1870
- The PostGIS-specific requirements
Example:
+/** + * Regression test for issue #1870 + * Validates that Unsupported types (specifically PostGIS geometry fields) + * can be used in @@index directives with PostGIS-specific index types. + */ describe('issue 1870', () => {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
packages/schema/src/language-server/validator/expression-validator.ts
(0 hunks)packages/schema/tests/schema/validation/datamodel-validation.test.ts
(1 hunks)tests/regression/tests/issue-1870.test.ts
(1 hunks)
💤 Files with no reviewable changes (1)
- packages/schema/src/language-server/validator/expression-validator.ts
🔇 Additional comments (1)
packages/schema/tests/schema/validation/datamodel-validation.test.ts (1)
78-78
: Verify error message consistency.
The error message change from "Field of 'Unsupported' type cannot be used in expressions" to "incompatible operand types" aligns with the PR objectives. However, let's verify this is consistent across the codebase.
✅ Verification successful
Error message change is consistent with the codebase
The search results confirm that the error message "incompatible operand types" is the standard error message used throughout the codebase for type incompatibility validation in expressions. This is evidenced by:
- The error message is consistently used in
expression-validator.ts
for various type incompatibility scenarios - Multiple test files (
attribute-validation.test.ts
,datamodel-validation.test.ts
) verify this error message - The old message "Field of 'Unsupported' type cannot be used in expressions" is not found anywhere else in the codebase
The change aligns with the existing error message patterns and maintains consistency across the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for other occurrences of the old error message to ensure all instances are updated
rg -l "Field of 'Unsupported' type cannot be used in expressions"
# Search for other error message definitions related to Unsupported types
rg "Unsupported.*type.*(?i)error"
Length of output: 109
Script:
#!/bin/bash
# Let's try a broader search for error messages related to type incompatibility in expressions
rg -i "incompatible.*type" -A 2 -B 2
# Also search for error messages containing 'operand'
rg -i "operand.*type" -A 2 -B 2
# Search for test cases related to type validation
fd "validation.*test" --exec grep -l "incompatible" {} \;
Length of output: 27613
fixes #1870