Class GraphQLModule

java.lang.Object
io.jooby.graphql.GraphQLModule
All Implemented Interfaces:
io.jooby.Extension

public class GraphQLModule extends Object implements io.jooby.Extension
GraphQL module on top of https://www.graphql-java.com.

Usage:


 // required:
 install(new Jackson2Module()); // or Jackson3Module, or AvajeJsonBModule, etc.

 install(new GrapQLModule(graphQL));

 
Module install a GET and POST route under /graphql path. Optionally, you can change the route path by setting the graphql.path property in your application configuration file.

NOTE: From 4.5.0 You must install a json module.

Since:
2.4.0
Author:
edgar
  • Constructor Summary

    Constructors
    Constructor
    Description
    GraphQLModule(graphql.GraphQL graphQL)
    Creates a new GraphQL module.
    GraphQLModule(graphql.schema.GraphQLSchema schema)
    Creates a new GraphQL module.
    GraphQLModule(graphql.schema.idl.RuntimeWiring wiring)
    Creates a new GraphQL module.
    GraphQLModule(String path, graphql.schema.idl.RuntimeWiring wiring)
    Creates a new GraphQL module.
    GraphQLModule(Path path, graphql.schema.idl.RuntimeWiring wiring)
    Creates a new GraphQL module.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    install(io.jooby.Jooby application)
     
    setAsync(boolean async)
    Whether GraphQL query run in async mode or not.
    setSupportGetRequest(boolean supportGetRequest)
    Whether to support HTTP GET request.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.jooby.Extension

    lateinit
  • Constructor Details

    • GraphQLModule

      public GraphQLModule(graphql.GraphQL graphQL)
      Creates a new GraphQL module.
      Parameters:
      graphQL - GraphQL instance.
    • GraphQLModule

      public GraphQLModule(graphql.schema.GraphQLSchema schema)
      Creates a new GraphQL module.
      Parameters:
      schema - GraphQL schema.
    • GraphQLModule

      public GraphQLModule(String path, graphql.schema.idl.RuntimeWiring wiring)
      Creates a new GraphQL module.
      Parameters:
      path - Classpath location for schema file. Usually schema.graphql.
      wiring - Runtime wiring to build a GraphQL instance.
    • GraphQLModule

      public GraphQLModule(Path path, graphql.schema.idl.RuntimeWiring wiring)
      Creates a new GraphQL module.
      Parameters:
      path - File system location for schema file. Usually schema.graphqls.
      wiring - Runtime wiring to build a GraphQL instance.
    • GraphQLModule

      public GraphQLModule(graphql.schema.idl.RuntimeWiring wiring)
      Creates a new GraphQL module. Load schema from default classpath location: schema.graphql .
      Parameters:
      wiring - Runtime wiring to build a GraphQL instance.
  • Method Details

    • install

      public void install(io.jooby.Jooby application) throws Exception
      Specified by:
      install in interface io.jooby.Extension
      Throws:
      Exception
    • setAsync

      public GraphQLModule setAsync(boolean async)
      Whether GraphQL query run in async mode or not. Default is true.
      Parameters:
      async - True to use async execution.
      Returns:
      This module.
    • setSupportGetRequest

      public GraphQLModule setSupportGetRequest(boolean supportGetRequest)
      Whether to support HTTP GET request.
      Parameters:
      supportGetRequest - True to support HTTP GET request.
      Returns:
      This module.