-
Notifications
You must be signed in to change notification settings - Fork 20
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
Contact queries with explicit property types part 1 #1252
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1252 +/- ##
==========================================
+ Coverage 81.42% 81.45% +0.02%
==========================================
Files 278 278
Lines 14620 14642 +22
==========================================
+ Hits 11905 11927 +22
Misses 2148 2148
Partials 567 567 ☔ View full report in Codecov by Sentry. |
@@ -5,6 +5,8 @@ import LexUnicode; | |||
// Lexer rules | |||
fragment HAS: [Hh][Aa][Ss]; | |||
fragment IS: [Ii][Ss]; | |||
fragment PROPTYPE: (UnicodeLetter)+; | |||
fragment PROPKEY: (UnicodeLetter | UnicodeDigit | '_')+; |
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.
you could make this stuff stricter but it's actually easier to deal with errors higher up in the parser rather in the lexer
@@ -21,6 +21,7 @@ const ( | |||
ErrUnsupportedContains = "unsupported_contains" // `property` the property key | |||
ErrUnsupportedComparison = "unsupported_comparison" // `property` the property key, `operator` one of =>, <, >=, <= | |||
ErrUnsupportedSetCheck = "unsupported_setcheck" // `property` the property key, `operator` one of =, != | |||
ErrUnknownPropertyType = "unknown_property_type" // `type` the property type |
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.
need to add support for this on RP side where we turn these into readable error messages
if err != nil { | ||
return NewQueryError(ErrInvalidLanguage, "'%s' is not a valid language code", c.value).withExtra("value", c.value) | ||
// for some text attributes, do some additional validation | ||
if c.propType == PropertyTypeAttribute { |
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.
little bit of reorg here so that if you have a field called language
.. we don't enforce that the value is valid language code etc
This adds support for parsing property conditions like
fields.age > 34
andurns.tel != ""
.Note that it doesn't normalize queries to look like that - that comes in separate push otherwise there's risk of one mailroom instance creating queries the other can't parse.