Package gql.ratpack

Class GraphQLHandlerUtil


  • public class GraphQLHandlerUtil
    extends Object
    Common functions to be used in handlers
    Since:
    0.3.1
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ratpack.func.Function<Map,​ratpack.exec.Promise<graphql.ExecutionResult>> executeGraphQL​(ratpack.handling.Context ctx)
      Wraps the execution of the GraphQL fetcher and returns a function that given a map it will return a Promise which will return an ExecutionResult
      static ratpack.func.Action<graphql.ExecutionResult> renderGraphQL​(ratpack.handling.Context ctx)
      Renders the fetcher result
      static ratpack.func.Action<com.fasterxml.jackson.core.JsonParseException> renderGraphQLError​(ratpack.handling.Context ctx)
      Takes `a JsonParseException and renders it as JSON to the output
    • Constructor Detail

      • GraphQLHandlerUtil

        public GraphQLHandlerUtil()
    • Method Detail

      • renderGraphQLError

        public static ratpack.func.Action<com.fasterxml.jackson.core.JsonParseException> renderGraphQLError​(ratpack.handling.Context ctx)
        Takes `a JsonParseException and renders it as JSON to the output
        Parameters:
        ctx - Ratpack's context
        Returns:
        an [@link Action} rendering the error
        Since:
        0.3.1
      • executeGraphQL

        public static ratpack.func.Function<Map,​ratpack.exec.Promise<graphql.ExecutionResult>> executeGraphQL​(ratpack.handling.Context ctx)
        Wraps the execution of the GraphQL fetcher and returns a function that given a map it will return a Promise which will return an ExecutionResult
        Parameters:
        ctx - Ratpack's context
        Returns:
        a Function
        Since:
        0.3.1
      • renderGraphQL

        public static ratpack.func.Action<graphql.ExecutionResult> renderGraphQL​(ratpack.handling.Context ctx)
        Renders the fetcher result
        Parameters:
        ctx - Ratpack's ctx
        Returns:
        an Action which returns an ExecutionResult
        Since:
        0.3.1