All Projects → google → Rejoiner

google / Rejoiner

Licence: apache-2.0
Generates a unified GraphQL schema from gRPC microservices and other Protobuf sources

Programming Languages

java
68154 projects - #9 most used programming language
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
shell
77523 projects

Projects that are alternatives of or similar to Rejoiner

Go Proto Gql
Protobuff plugins for generating graphql schema and golang to graphql bindings. Also supports a graphql gateway (Alpha)
Stars: ✭ 127 (-96.3%)
Mutual labels:  graphql, grpc, graphql-server
Graphql To Mongodb
Allows for generic run-time generation of filter types for existing graphql types and parsing client requests to mongodb find queries
Stars: ✭ 261 (-92.4%)
Mutual labels:  graphql, graphql-server
gruf-demo
A demonstration Rails application utilizing gruf, a gRPC Rails framework.
Stars: ✭ 42 (-98.78%)
Mutual labels:  protobuf, grpc
Create Graphql Server
Generate your GraphQL server one type at a time
Stars: ✭ 321 (-90.65%)
Mutual labels:  graphql, graphql-server
docker-protobuf
An all-inclusive protoc Docker image
Stars: ✭ 105 (-96.94%)
Mutual labels:  protobuf, grpc
grpc-spring-security-demo
Spring Boot-based gRPC server with gRPC endpoints secured by Spring Security
Stars: ✭ 50 (-98.54%)
Mutual labels:  protobuf, grpc
Graphik
Graphik is a Backend as a Service implemented as an identity-aware document & graph database with support for gRPC and graphQL
Stars: ✭ 277 (-91.93%)
Mutual labels:  graphql, grpc
tsrpc
A TypeScript RPC framework, with runtime type checking and serialization, support both HTTP and WebSocket. It is very suitable for website / APP / games, and absolutely comfortable to full-stack TypeScript developers.
Stars: ✭ 866 (-74.77%)
Mutual labels:  protobuf, grpc
Yarpc Go
A message passing platform for Go
Stars: ✭ 285 (-91.7%)
Mutual labels:  grpc, protobuf
Morpheus Graphql
Haskell GraphQL Api, Client and Tools
Stars: ✭ 285 (-91.7%)
Mutual labels:  graphql, graphql-server
Dgraph
Native GraphQL Database with graph backend
Stars: ✭ 17,127 (+399.04%)
Mutual labels:  graphql, graphql-server
xrgrpc
gRPC library for Cisco IOS XR
Stars: ✭ 40 (-98.83%)
Mutual labels:  protobuf, grpc
api
Temporal gRPC API and proto files
Stars: ✭ 25 (-99.27%)
Mutual labels:  protobuf, grpc
Altair
✨⚡️ A beautiful feature-rich GraphQL Client for all platforms.
Stars: ✭ 3,827 (+11.51%)
Mutual labels:  graphql, graphql-server
grpcman
A grpc testing tool based on Electron & Vue.js & Element-UI
Stars: ✭ 22 (-99.36%)
Mutual labels:  protobuf, grpc
Wp Graphql
🚀 GraphQL API for WordPress
Stars: ✭ 3,097 (-9.76%)
Mutual labels:  graphql, graphql-server
Flatbuffers
FlatBuffers: Memory Efficient Serialization Library
Stars: ✭ 17,180 (+400.58%)
Mutual labels:  grpc, protobuf
nameko-grpc
GRPC Extensions for Nameko
Stars: ✭ 51 (-98.51%)
Mutual labels:  protobuf, grpc
vtprotobuf
A Protocol Buffers compiler that generates optimized marshaling & unmarshaling Go code for ProtoBuf APIv2
Stars: ✭ 418 (-87.82%)
Mutual labels:  protobuf, grpc
Graphql Clj
A Clojure library that provides GraphQL implementation.
Stars: ✭ 281 (-91.81%)
Mutual labels:  graphql, graphql-server

Rejoiner

Build Status Coverage Status Codacy Badge Maven Central

  • Creates a uniform GraphQL schema from microservices
  • Allows the GraphQL schema to be flexibly defined and composed as shared components
  • Generates GraphQL types from Proto definitions
  • Populates request Proto based on GraphQL query parameters
  • Supplies a DSL to modify the generated schema
  • Joins data sources by annotating methods that fetch data
  • Creates Proto FieldMasks based on GraphQL selectors

Rejoiner Overview

Experimental Features

These features are actively being developed.

  • Expose any GraphQL schema as a gRPC service.
  • Lossless end to end proto scalar types when using gRPC.
  • Relay support [Example]
  • GraphQL Stream (based on gRPC streaming) [Example]

Schema Module

SchemaModule is a Guice module that is used to generate parts of a GraphQL schema. It finds methods and fields that have Rejoiner annotations when it's instantiated. It then looks at the parameters and return type of these methods in order to generate the appropriate GraphQL schema. Examples of queries, mutations, and schema modifications are presented below.

GraphQL Query

final class TodoQuerySchemaModule extends SchemaModule {
  @Query("listTodo")
  ListenableFuture<ListTodoResponse> listTodo(ListTodoRequest request, TodoClient todoClient) {
    return todoClient.listTodo(request);
  }
}

In this example request is of type ListTodoRequest (a protobuf message), so it's used as a parameter in the generated GraphQL query. todoService isn't a protobuf message, so it's provided by the Guice injector.

This is useful for providing rpc services or database access objects for fetching data. Authentication data can also be provided here.

Common implementations for these annotated methods:

  • Make gRPC calls to microservices which can be implemented in any language
  • Load protobuf messages directly from storage
  • Perform arbitrary logic to produce the result

GraphQL Mutation

final class TodoMutationSchemaModule extends SchemaModule {
  @Mutation("createTodo")
  ListenableFuture<Todo> createTodo(
      CreateTodoRequest request, TodoService todoService, @AuthenticatedUser String email) {
    return todoService.createTodo(request, email);
  }
}

Adding edges between GraphQL types

In this example we are adding a reference to the User type on the Todo type.

final class TodoToUserSchemaModule extends SchemaModule {
  @SchemaModification(addField = "creator", onType = Todo.class)
  ListenableFuture<User> todoCreatorToUser(UserService userService, Todo todo) {
    return userService.getUserByEmail(todo.getCreatorEmail());
  }
}

In this case the Todo parameter is the parent object which can be referenced to get the creator's email.

This is how types are joined within and across APIs.

Rejoiner API Joining

Removing a field

final class TodoModificationsSchemaModule extends SchemaModule {
  @SchemaModification
  TypeModification removePrivateTodoData =
      Type.find(Todo.getDescriptor()).removeField("privateTodoData");
}

Building the GraphQL schema

import com.google.api.graphql.rejoiner.SchemaProviderModule;

public final class TodoModule extends AbstractModule {
  @Override
  protected void configure() {
    // Guice module that provides the generated GraphQLSchema instance
    install(new SchemaProviderModule());

    // Install schema modules
    install(new TodoQuerySchemaModule());
    install(new TodoMutationSchemaModule());
    install(new TodoModificationsSchemaModule());
    install(new TodoToUserSchemaModule());
  }
}

Getting started

Dependency information

Apache Maven

<dependency>
    <groupId>com.google.api.graphql</groupId>
    <artifactId>rejoiner</artifactId>
    <version>0.0.4</version>
</dependency>

Gradle/Grails compile 'com.google.api.graphql:rejoiner:0.0.4'

Scala SBT libraryDependencies += "com.google.api.graphql" % "rejoiner" % "0.0.4"

Supported return types

All generated proto messages extend Message.

  • Any subclass of Message
  • ImmutableList<? extends Message>
  • ListenableFuture<? extends Message>
  • ListenableFuture<ImmutableList<? extends Message>>

Project information

  • Rejoiner is built on top of GraphQL-Java which provides the core GraphQL capabilities such as query parsing, validation, and execution.
  • Java code is formatted using google-java-format.
  • Note: This is not an official Google product.
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].