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

fix(GraphQL): fix multiple alias in query #6940

Merged
merged 2 commits into from
Nov 23, 2020
Merged

Conversation

minhaj-shakeel
Copy link
Contributor

@minhaj-shakeel minhaj-shakeel commented Nov 23, 2020

Fixes GRAPHQL-806.
Fixes GRAPHQL-793.

This PR extends support for multiple aliases for the same field (except those which are inbuilt) in one query.
For eg:
For the Given Schema:

type Author {
        id: ID!
        posts: [Post!] @hasInverse(field: author)
}

type Post {
        postID: ID!
        title: String! @search(by: [term])
        text: String @search(by: [fulltext])
        isPublished: Boolean @search
        author: Author!
}

The given query:

queryAuthor {
        name
        p1: posts(filter: {isPublished: true}){
          title
          text
        }
        p2: posts(filter: {isPublished: false}){
          title
          text
        }
      }

Earlier the results we picked up only for the first alias for posts i.e p1 and the results into p2 were copied from the p1. This PR fixes that.
Now, p1 should contain all those posts which have isPublished: true and p2 will contain all those posts which have isPublished: false.


This change is Reviewable

@github-actions github-actions bot added the area/graphql Issues related to GraphQL support on Dgraph. label Nov 23, 2020
@netlify
Copy link

netlify bot commented Nov 23, 2020

Deploy preview for dgraph-docs ready!

Built with commit c7e96db

https://deploy-preview-6940--dgraph-docs.netlify.app

Copy link
Contributor

@vmrajas vmrajas left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 6 files at r1, 1 of 1 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @MichaelJCompton and @pawanrawal)

@minhaj-shakeel minhaj-shakeel merged commit 0be022a into master Nov 23, 2020
@minhaj-shakeel minhaj-shakeel deleted the minhaj/alias-in-query branch November 23, 2020 05:51
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