Coder Social home page Coder Social logo

temaemelyan / nadel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from atlassian-labs/nadel

0.0 1.0 0.0 1.66 MB

A GraphQL DSL and execution engine for distributed schemas

License: MIT License

ANTLR 0.23% Java 53.82% Groovy 45.84% Shell 0.11%

nadel's Introduction

Nadel: A distributed GraphQL engine

Nadel is a Java library to combine several graphql services together. This is achieved by combining several underlying GraphQL services (schemas) into one schema (overall schema).

The main purpose of this library is to power a GraphQL gateway which serves as the entry point for executing requests across different services while presenting one GraphQL API.

Nadel GraphQL Gateway

This is achieved by declaring the services, which should be combined, in a DSL which is build on top of the GraphQL SDL (Schema Definition Language).

While this library is in Java, the underlying services only need to provide a standard GraphQL API and no Java Code is required to combine services together. It is all done declarative as part of the DSL.

Example:

Lets assume we have two Services: "Issues" and "Users". One has Issues and one has Users. An Issue has a reference to its authors.

This is the schema for the Issues service:

type Query {
    issues: [Issue]
}
type Issue {
    id: ID
    authorIds: [ID]
}

And this is the Users service:

type Query {
    users(ids: [ID]): [User]
}
type User {
    id: ID
    fullName: String
}

This is how you would combine these two services together with Nadel while also renaming a field at the same time.

service Issues {
    type Query {
        issues: [Issue]
    }
    type Issue {
        id: ID
        authors: [User] => hydrated from Users.usersById(id: $source.authorIds) object identified by id, batch size 10
    }
}

service Users {
    type Query {
        users(ids: [ID]): [User]
    }
    type User {
        id: ID
        name: String => renamed from fullName
    }
}

The result is a new GraphQL API which combines the two services in one and has the following schema:

type Query {
    issues: [Issue]
    users(ids: [ID]): [User]
}       
type Issue {
    id: ID
    authors: [User]
}
type User {
    id: ID
    name: String
}

Features

  • Explicit overall schema design: every field for the overall schema needs to be declared in the Nadel DSL. If it is not declared it will not be exposed
  • Hydration: resolving referencing to other objects by calling another service
  • Field rename: renaming field from the underlying schema to a new name in the overall schema
  • Type rename: renaming a type from the underlying schema to a new name in the overall schema
  • Batching: Hydration calls are automatically batched with a configurable max batch size per call

Getting started

nadel's People

Contributors

andimarek avatar bbakerman avatar gnawf avatar johnliucn925 avatar tsroka avatar danieltreacy avatar faizan-siddiqui avatar simeonleatherland avatar

Watchers

James Cloos 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.