-
Notifications
You must be signed in to change notification settings - Fork 3
As a user, I want to know why my query syntax is invalid #26
Comments
@tloubrieu-jpl so was this closed per #15 or is this a follow-on? |
@jordanpadams this is a follow on |
I do not think that the lexer/parser tool (ANTLR) gives enough visibility to do what is being requested. For instance, not( a eq b ) will fail but it is because of a token failure in ANTLR that gives odd messages like token not FIELD or illegal character cannot form token. There is no way to reverse it to say it should have been not ( a eq b ). With gte as in example, ANTLR fails with cryptic at best information but does not relinquish control to add a message that would allow one to detect that it was an illegal operator. If this desire is required, then you will probably need to replace ANTLR. |
+1 thanks @al-niessner . we will need to maybe table this for a future build to investigate how we can accomplish this solution |
@al-niessner @jordanpadams what if we have the message illegal token and the name of the token 'not(' in the message. That would not be too bad to help the user to figure a space is needed ? For now we have nothing as error messages so I would like to initiate that behavior of the API where we can return error messages. We can discuss that at the next breakout. |
Here are some simple examples from the unit testing of the lexer/parser:
Lets go through each of these:
Skipping a few to ' ( a amd b ) The point is that knowing the lexer/parser and the syntax being used, it is possible to reverse the meaning. However doing this in code is going to require building a very complex parser to figure out why the lexer/parser exception occurred. Cannot even really use the extensions to the lexer/parser to help because the "operator" calls are never called in the last example because the lexer/parser treats |
@al-niessner thanks for investigating this. looking at the bugs and features that are creeping up in this repo, I think we have bigger fish to fry at the moment. I am going to defer this to a future sprint/build. |
Issue moved to NASA-PDS/registry-api #13 via ZenHub |
Motivation
...so that I can update my query (q param) to make it work
Additional Details
Acceptance Criteria
Given deployed API server
When I perform request q=ops:Data_File_Info.ops:file_size gte 138172
Then I expect an explicit error message like "Unkown operator gte", status 400
To be completed
Engineering Details
I believe this can be easily added by using messages in the ParseCancellationException and throwing the exception all the way through the api controllers. Actually this requires a bit a research to understand how a springboot controller method can returm multiple type (products or error).
The text was updated successfully, but these errors were encountered: