I’ve found a few issues with custom dql queries and I think it’s important to make these limitations clear within the docs as well.
- checkpwd is currently not working
The auth support does a lot of manual rewriting and I guess the teams forgot to add checkpwd. I was able to add it on my local branch. But then I found another issue: - // Only uid(0x123, 0x124), type(…) and eq(Type.Predicate, …) functions are supported at root.
This means that in the above dql query the authenticate query part does not work, because it uses the val(…) function inside of eq(…). In my tests the rewritten authenticate query looks like this:
authenticate(func: eq(check, "1")) {
id : uid
username : User.username
email : User.email
}
I will create a pull request for the checkpwd issue and might extend the functionality of the query root in due time.
I have a question though. Is it really necessary to rewrite all of the dql queries? This seems like a lot of manual work atm and in the end the query looks exactly the same as it was before rewriting, except that variables are replaced with their literal values. A simple string replace should be sufficient for that.
I thought auth is just doing additional queries, so there should be no meddling with the actual dql queries right?
I’m sorry if I see things too simple and I do not want to discredit any work! I am still veery unknowledgable about the dgraph code and its workings.