Skip to content

fix(graphql): Checkpwd func and val inside eq func now work in custom dql #8103

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

Closed
wants to merge 5 commits into from

Conversation

Schartey
Copy link

@Schartey Schartey commented Dec 1, 2021

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.


This change is Reviewable

@Schartey Schartey requested a review from manishrjain as a code owner December 3, 2021 10:19
@CLAassistant
Copy link

CLA assistant check
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.

@MichelDiz MichelDiz added area/querylang Issues related to the query language specification and implementation. Check if resolved labels Sep 13, 2022
@MichelDiz
Copy link
Contributor

@Schartey Master doesn't exist anymore. Can you open a new PR pointing to Main?
Closing and waiting a New PR.

Thank you.

@MichelDiz MichelDiz closed this Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/querylang Issues related to the query language specification and implementation. Check if resolved
Development

Successfully merging this pull request may close these issues.

3 participants