Package gql.ratpack
Class GraphQLHandlerUtil
- java.lang.Object
-
- gql.ratpack.GraphQLHandlerUtil
-
public class GraphQLHandlerUtil extends Object
Common functions to be used in handlers- Since:
- 0.3.1
-
-
Field Summary
Fields Modifier and Type Field Description static String
RATPACK_CONTEXT_KEY
-
Constructor Summary
Constructors Constructor Description GraphQLHandlerUtil()
-
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 aPromise
which will return anExecutionResult
static ratpack.func.Action<graphql.ExecutionResult>
renderGraphQL(ratpack.handling.Context ctx)
Renders the fetcher resultstatic ratpack.func.Action<com.fasterxml.jackson.core.JsonParseException>
renderGraphQLError(ratpack.handling.Context ctx)
Takes `aJsonParseException
and renders it as JSON to the output
-
-
-
Field Detail
-
RATPACK_CONTEXT_KEY
public static final String RATPACK_CONTEXT_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
renderGraphQLError
public static ratpack.func.Action<com.fasterxml.jackson.core.JsonParseException> renderGraphQLError(ratpack.handling.Context ctx)
Takes `aJsonParseException
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 aPromise
which will return anExecutionResult
- 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 anExecutionResult
- Since:
- 0.3.1
-
-