springspring-bootgraphqlgraphql-java

Is there a recommended library for building GraphQL queries?


I'm calling a service that exposes a GraphQL interface. So I'm able to post a GraphQL query and receive data back via curl. Now I want to write a service that builds the query for me (dynamically, based on query parameters I send my endpoint) and sends the request and gets the response back.

I'm using Spring Boot 2.1.4.

I know you can build queries with the elastic search library in Spring. Wondering if there's something similar for GraphQL.


Solution

  • There are a few clients, taking rather different approaches.

    1. Spring's GraphQL client - Dynamic client (with optional response-to-POJO mapping)
    2. SmallRye GraphQL - Offers both a dynamic and a typesafe client
    3. Netflix DGS client - Has both a simple and a type-safe client
    4. Apollo Kotlin - Generates Kotlin and Java models from GraphQL queries.
    5. There's a Node based Java client generator and a Maven plugin for it too.
    6. Nodes
    7. Shopify's GraphQL code gen - Needs (J)Ruby to run but generates Java code.
    8. Manifold can be used as a GraphQL client

    These are all different beasts, as you'll see, so you'll have to decide what fits.