Skip to content
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

graphql: move alias to end of graphql pipeline #5369

Merged
merged 7 commits into from
May 12, 2020

Conversation

MichaelJCompton
Copy link
Contributor

@MichaelJCompton MichaelJCompton commented May 5, 2020

We used to write alias into the Dgraph query so that the result already had the alias computed in it. That turns out to be awkward as we add more functionality, because:

  • admin then has to do it's own alias
  • custom logic needs to deal with alias

This PR move all alias handling to the very last step as we write the final result. This means that throughout the pipeline all intermediate results are in terms of the schema fields.

I added an alias test for /admin ... not sure if we need to test everything there for alias. I feel that what we have is enough because you now can't return a result without it going through the GraphQL completion algorithm, so everything should be covered and it would take a big refactor to change that.


This change is Reviewable

Docs Preview: Dgraph Preview

@MichaelJCompton MichaelJCompton requested review from manishrjain and a team as code owners May 5, 2020 07:42
@MichaelJCompton MichaelJCompton added the area/graphql Issues related to GraphQL support on Dgraph. label May 5, 2020
Copy link
Contributor

@pawanrawal pawanrawal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm_strong: love how the change was so simple.

Reviewed 15 of 15 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @manishrjain and @MichaelJCompton)


graphql/resolve/resolver_test.go, line 59 at r1 (raw file):

			if resp.Errors != nil {
				fmt.Println(resp.Errors)

This could be part of the Nilf check below.

@MichaelJCompton MichaelJCompton merged commit cb01b0d into master May 12, 2020
@MichaelJCompton MichaelJCompton deleted the mjc/graphql-alias branch May 12, 2020 02:58
harshil-goel pushed a commit that referenced this pull request May 20, 2020
harshil-goel added a commit that referenced this pull request May 20, 2020
dna2github pushed a commit to dna2fork/dgraph that referenced this pull request Jul 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/graphql Issues related to GraphQL support on Dgraph.
Development

Successfully merging this pull request may close these issues.

2 participants