Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Spring Boot Graphql Remove duplicates from the Response #905

Description

@miriyalajanardhan

How to remove the duplicates from the response of Graphql automatically

Lets see the below graphql request I have.

query {
  test1(request:{
            userId: "test1@test.com"
  }) {
       id
       name
       product
  }
}

And the Response is below:

{
    "data": {
        "test1": [{
                "id": 1,
                "name": "Test",
                "product": "ABCD"
            }, {
                "id": 1,
                "name": "Test",
                "product": "ABCD-2"
            },
        ]
    }
}

Now if I remove the "product" in the query response field, the reponse looks like below. That is where the duplicates come.

{
    "data": {
        "test1": [{
                "id": 1,
                "name": "Test"
            }, {
                "id": 1,
                "name": "Test"
            },
        ]
    }
}

Let me know if we have any library available to do this. We are using Spring Boot with below dependency.

<dependency>
    <groupId>com.graphql-java-kickstart</groupId>
    <artifactId>graphql-spring-boot-starter</artifactId>
    <version>14.1.0</version>
</dependency>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions