All Projects → nfl → glitr

nfl / glitr

Licence: MIT license
GLiTR - /ˈɡlɪtər/ POJO to GraphQL schema made easy

Programming Languages

java
68154 projects - #9 most used programming language
groovy
2714 projects
shell
77523 projects

GLiTR

Build Status Maven Central Download License

A library that lets you use Plain Old Java Objects to describe your GraphQL schema.

Binaries

Example for Maven:

<dependency>
    <groupId>com.nfl.glitr</groupId>
    <artifactId>glitr</artifactId>
    <version>x.y.z</version>
</dependency>

Example for gradle:

compile("com.nfl.glitr:glitr:x.y.z")

Change history can be found here: CHANGELOG.md

How to use the latest build with Gradle

Add the repositories:

repositories {
    maven { url  "http://dl.bintray.com/nfl/maven" }
}

Dependency:

dependencies {
  compile 'com.nfl.glitr:INSERT_LATEST_VERSION_HERE'
}

How to use the latest build with Maven

Add the repository:

<repository>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
    <id>bintray-nfl-maven</id>
    <name>bintray</name>
    <url>http://dl.bintray.com/nfl/maven</url>
</repository>

Dependency:

<dependency>
    <groupId>com.nfl.glitr</groupId>
    <artifactId>glitr</artifactId>
    <version>INSERT_LATEST_VERSION_HERE</version>
</dependency>

How to use it

This is the famous "hello world" in graphql-java with GLiTR:

import com.nfl.glitr.Glitr;
import com.nfl.glitr.GlitrBuilder;
import com.nfl.glitr.annotation.GlitrDescription;
import graphql.GraphQL;
import graphql.schema.DataFetchingEnvironment;

import java.util.Map;

public class HelloWorld {

    public static void main(String[] args) {

        Glitr glitr = GlitrBuilder.newGlitr()
                .withQueryRoot(new Root())
                .build();

        GraphQL graphQL = new GraphQL(glitr.getSchema());

        Map<String, Object> result = (Map<String, Object>) graphQL.execute("{hello}").getData();

        System.out.println(result); // Prints: {hello=World!}
    }

    @GlitrDescription("Where it all begins.")
    public static class Root {

        public String getHello(DataFetchingEnvironment environment) {
            return "World!";
        }
    }
}

Full Documentation

See the Wiki for full documentation, examples, operational details and other information.

Build

To build:

$ git clone [email protected]:NFL/glitr.git
$ cd glitr/
$ ./gradlew build

Further details on building can be found on the Getting Started page of the wiki.

Requirements

  • = Java 8

Examples

See glitr-examples for example implementation

Contact Info

LICENSE

GLiTR is licensed under the MIT License. See LICENSE for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].