-
Notifications
You must be signed in to change notification settings - Fork 100
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
[master < T0869] Implement GraphQL compatibility #1018
Conversation
Initial version of an e2e testing framework that can be used to run graphql queries end to end with memgraph. For the 'create' graphql query to work, the awesome memgraph function, randomUUID, had to be added. Further more a temporary query module is loaded in the workload to emulate the initial query to the database. This should be changed later.
The incoming queries should be inspected and certain keywords should be swapped into memgraph specific ones. As this is modifying the query string itself, the interpreter should not be modified because of this.
The added procedures can not be named mgp.*, that way they won't show up in the module registry. The path to the GraphQL library specifying js files has been changed.
The util.validate procedure could not be added as a simple query procedure, because the procedure itself does not return anything, which is something we do not support atm, and we do not have the ability to evaluate expressions from query procedures. They it has been solved, is that the during parsing, we check if the given CALL procedure does not YIELD, and if the fully qualified name of the procedure matches util.validate and based on this, we can instantiate an appropriate cursur and put that into the pull-chain instead of the regular CallProcedureCursor. On top of this '_' is sometimes generated as a variable name we did not support. Support for that has been added as well.
Add config js files to be able to test graphql capabilites against basic CRUD operations. Add a setup file that is installing the dependencies.
Add tests to be able to test the basic CRUD functionality of memgraph when running it against GraphQL.
Instead of hardcoding the mappings in memory, use a json config file to read in the mappings between procedure names. Add flag 'callable_mappings_path' to be able to specify the path to said config file. Make names more generic.
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.
Looks OK, main issue I have is that the CALL without YIELD logic should be generic and not implemented to work just for the validate procedure. Other than that, it's mostly just some small comments.
I also think we are calling FindAlias twice when we could call it just once.
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.
Nice job gabor! I added some comments, let me know what you think
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.
Comments about existing stuff and few smaller things
Added additional sleepint to the startup process as it seems that other parts of the testing setup are not finished initializing as the GraphQL server itself. Reversed logic when reading the alias mapping config.
Make sure nothing runs on the dedicated port upon process startup, this can be problematic if the process was stuck before, than the subsequent process spawn attempts will be meaningless.
There was a slight linking issue with adding query realated objects, like TypedValue to utils, so a templated class has been used instead. A concepts that enforces the used functions of TypedValue has been created and a Dummy mock version of it is being used in the unit tests.
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.
I really like the refactoring job you made and have just 2-3 more questions/suggestions.
Trying to run create mutation and get the following error message:
What am I doing wrong here? |
@katarinasupe |
@gvolfing please ignore my bug report above. I used the older version of Lab (2.7.0) and hence experienced such issues since I was running with 'Run selected' which was not working well. When I updated to Lab 2.7.1, deletes are working as expected so far. |
I tried out some basic queries and aggregation queries. I also tried to create, update and delete mutations. Let me know if something needs to be added. My test examples and dataset can be found in Notion under Testing. |
* Add callable mappings feature * Implement mgps.validate (void procedure) * Make '_' a valid variable name
Closes #869