-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix(GraphQL): fix internal Aliases name generation #7009
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
minhaj-shakeel
requested review from
MichaelJCompton and
pawanrawal
as code owners
November 27, 2020 04:35
github-actions
bot
added
the
area/graphql
Issues related to GraphQL support on Dgraph.
label
Nov 27, 2020
Deploy preview for dgraph-docs ready! Built with commit 5fa1c59 |
minhaj-shakeel
changed the title
feat
fix(GraphQL): fix internal Aliases name generation
Nov 27, 2020
pawanrawal
approved these changes
Dec 3, 2020
abhimanyusinghgaur
added a commit
that referenced
this pull request
Dec 14, 2020
The test broke after merging #7009 in master.
abhimanyusinghgaur
pushed a commit
that referenced
this pull request
Dec 14, 2020
This PR modifies how the internal graph aliases are generated in case of multiple aliases of same field in the query. For the given graphql query: ``` query { queryAuthor { name p1: posts(filter: {isPublished: true}){ title text } p2: posts(filter: {isPublished: true}){ title text } } } ``` earlier it was rewritten into: ``` query { queryAuthor(func: type(Author)) { name : Author.name posts : Author.posts @filter(eq(Post.isPublished, true)) { title : Post.title text : Post.text dgraph.uid : uid } posts1 : Author.posts @filter(eq(Post.isPublished, true)) { title : Post.title text : Post.text dgraph.uid : uid } dgraph.uid : uid } } ``` Now it is changed to: ``` query { queryAuthor(func: type(Author)) { name : Author.name posts : Author.posts @filter(eq(Post.isPublished, true)) { title : Post.title text : Post.text dgraph.uid : uid } posts.1 : Author.posts @filter(eq(Post.isPublished, true)) { title : Post.title text : Post.text dgraph.uid : uid } dgraph.uid : uid } } ``` (cherry picked from commit 953f656)
abhimanyusinghgaur
added a commit
that referenced
this pull request
Dec 14, 2020
abhimanyusinghgaur
added a commit
that referenced
this pull request
Dec 14, 2020
* fix(GraphQL): fix internal Aliases name generation (#7009) This PR modifies how the internal graph aliases are generated in case of multiple aliases of same field in the query. For the given graphql query: ``` query { queryAuthor { name p1: posts(filter: {isPublished: true}){ title text } p2: posts(filter: {isPublished: true}){ title text } } } ``` earlier it was rewritten into: ``` query { queryAuthor(func: type(Author)) { name : Author.name posts : Author.posts @filter(eq(Post.isPublished, true)) { title : Post.title text : Post.text dgraph.uid : uid } posts1 : Author.posts @filter(eq(Post.isPublished, true)) { title : Post.title text : Post.text dgraph.uid : uid } dgraph.uid : uid } } ``` Now it is changed to: ``` query { queryAuthor(func: type(Author)) { name : Author.name posts : Author.posts @filter(eq(Post.isPublished, true)) { title : Post.title text : Post.text dgraph.uid : uid } posts.1 : Author.posts @filter(eq(Post.isPublished, true)) { title : Post.title text : Post.text dgraph.uid : uid } dgraph.uid : uid } } ``` (cherry picked from commit 953f656) * chore: fix a broken test (#7130) The test broke after merging #7009 in master. (cherry picked from commit 09274fb) Co-authored-by: minhaj-shakeel <minhaj@dgraph.io>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR modifies how the internal graph aliases are generated in case of multiple aliases of same field in the query.
For the given graphql query:
earlier it was rewritten into:
Now it is changed to:
Notice that new alias for second posts query is
posts.1
instead ofposts1
. This is done to avoid issues in case if theAuthor
have any field namedposts1
. Nowposts.1
cannot be a field ofAuthor
as it results in a syntax error.This change is