Giter Site home page Giter Site logo

lakecenter / graphql-java-tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from graphql-java-kickstart/graphql-java-tools

0.0 2.0 0.0 480 KB

A schema-first tool for graphql-java inspired by graphql-tools for JS

Home Page: https://www.graphql-java-kickstart.com/tools/

License: MIT License

Java 6.58% Kotlin 58.22% Groovy 34.70% Shell 0.51%

graphql-java-tools's Introduction

GraphQL Java Tools

TravisCI Build Maven Central Chat on Gitter

This library allows you to use the GraphQL schema language to build your graphql-java schema. Inspired by graphql-tools, it parses the given GraphQL schema and allows you to BYOO (bring your own object) to fill in the implementations. GraphQL Java Tools works extremely well if you already have domain POJOs that hold your data (e.g. for RPC, ORM, REST, etc) by allowing you to map these magically to GraphQL objects.

GraphQL Java Tools aims for seamless integration with Java, but works for any JVM language. Try it with Kotlin!

WARNING: NoClassDefFoundError when using Spring Boot

If you're using graphl-java-tools you need to set the kotlin.version in your Spring Boot project explicitly to version 1.3.10, because Spring Boot Starter parent currently overrides it with a 1.2.* version of Kotlin. graphql-java-tools requires 1.3.* however because of its coroutine support. If you don't override this version you will run into a NoClassDefFoundError.

Spring Boot team has indicated the Kotlin version will be upgraded to 1.3 in Spring Boot 2.2.

Using Gradle

Set the Kotlin version in your gradle.properties

kotlin.version=1.3.10

Using Maven

Set the Kotlin version in your <properties> section

<properties>
  <kotlin.version>1.3.10</kotlin.version>
</properties>

Documentation

Take a look at our new documentation for more details.

Why GraphQL Java Tools?

  • Schema First: GraphQL Java Tools allows you to write your schema in a simple, portable way using the GraphQL schema language instead of hard-to-read builders in code.
  • Minimal Boilerplate: It takes a lot of work to describe your GraphQL-Java objects manually, and quickly becomes unreadable. A few libraries exist to ease the boilerplate pain, including GraphQL-Java's built-in schema-first wiring, but none (so far) do type and datafetcher discovery.
  • Stateful Data Fetchers: If you're using an IOC container (like Spring), it's hard to wire up datafetchers that make use of beans you've already defined without a bunch of fragile configuration. GraphQL Java Tools allows you to register "Resolvers" for any type that can bring state along and use that to resolve fields.
  • Generated DataFetchers: GraphQL Java Tools automatically creates data fetchers for your fields that call the appropriate method on your java class. This means all you have to do to create a new field is add the field definition to your schema and add a corresponding method on your class.
  • Type->Class Discovery: GraphQL Java Tools starts from your root objects (Query, Mutation) and, as it's generating data fetchers for you, starts to learn about the classes you use for a certain GraphQL type.
  • Class Validation: Since there aren't any compile-time checks of the type->class relationship, GraphQL Java Tools will warn you if you provide classes/types that you don't need to, as well as erroring if you use the wrong Java class for a certain GraphQL type when it builds the schema.
  • Unit Testing: Since your GraphQL schema is independent of your data model, this makes your classes simple and extremely testable.

Build with Maven or Gradle

<dependency>
    <groupId>com.graphql-java-kickstart</groupId>
    <artifactId>graphql-java-tools</artifactId>
    <version>5.4.1</version>
</dependency>
compile 'com.graphql-java-kickstart:graphql-java-tools:5.4.1'

New releases will be available faster in the JCenter repository than in Maven Central. Add the following to use for Maven

<repositories>
    <repository>
      <id>jcenter</id>
      <url>https://jcenter.bintray.com/</url>
    </repository>
</repositories>

For Gradle:

repositories {
    jcenter()
}

graphql-java-tools's People

Contributors

apottere avatar oliemansm avatar gipeshka avatar varahash avatar acidbluebriggs avatar sp00m avatar jdorleans avatar kammerertob avatar visualage avatar ash211 avatar bentatham avatar ddtxra avatar ch-ericlundberg avatar filipncs avatar jflorencio avatar joshcanfield avatar lburja avatar marcust avatar martinlansler avatar nickweedon avatar paveliarch avatar peterholak avatar ruifigueira avatar also avatar rwilliams-r7 avatar b4eex avatar yasinuslu avatar nspilanis avatar tim-mit avatar yarinvak avatar

Watchers

James Cloos avatar 张江平 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.