dgraph
dgraph copied to clipboard
fix(graphql): Checkpwd func and val inside eq func now work in custom dql
The checkpwd func does not work in custom dql queries since #7775 . The query rewriter for custom dql did not handle the checkpwd function. Also it did not allow to use val inside of the eq function.
Example:
type Query {
authenticate(username: String, email: String, password: String!): [User] @custom(dql: """
query q($username: string, $email: string, $password: string) {
var(func: type(User)) @filter(eq(User.username, $username) OR eq(User.email, $email)) {
check as checkpwd(User.password, $password)
}
authenticate(func: eq(val(check), 1)) {
id: uid
username: User.username
email: User.email
}
}
"""
)
}
This query uses checkpwd in the first query, which would be rewritten to
check as User.password)
and it uses func: eq(val(check), 1) in the second query, which would result in
func: eq(check, "1")
I added handling for both of these issues. The issue has also been documented in discuss
Please let me know if I missed something. I would be glad if this could make it into the next release, as it is a minor change.
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
@Schartey Master doesn't exist anymore. Can you open a new PR pointing to Main? Closing and waiting a New PR.
Thank you.