Interface ExecutionGraphQlRequest

All Superinterfaces:
GraphQlRequest
All Known Implementing Classes:
DefaultExecutionGraphQlRequest, RSocketGraphQlRequest, WebGraphQlRequest, WebSocketGraphQlRequest

public interface ExecutionGraphQlRequest extends GraphQlRequest
Implementation of GraphQlRequest for request handling through GraphQL Java with support for customizing the ExecutionInput passed into GraphQL.
Since:
1.0.0
Author:
Rossen Stoyanchev, Brian Clozel
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Set<graphql.language.OperationDefinition.Operation>
    All operation types supported by GraphQL.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    allowedOperations(Set<graphql.language.OperationDefinition.Operation> operations)
    Restrict the operation types that may be executed for this request.
    void
    configureExecutionInput(BiFunction<graphql.ExecutionInput, graphql.ExecutionInput.Builder, graphql.ExecutionInput> configurer)
    Provide a BiFunction to help initialize the ExecutionInput passed to GraphQL.
    void
    executionId(graphql.execution.ExecutionId executionId)
    Configure the ExecutionId to set on ExecutionInput.getExecutionId(), overriding the transport assigned id.
    default Set<graphql.language.OperationDefinition.Operation>
    Return the GraphQL operation types that may be executed for this request.
    @Nullable graphql.execution.ExecutionId
    Return the configured executionId.
    Return the transport assigned id for the request that in turn sets executionId.
    @Nullable Locale
    Return the transport assigned locale value, if any.
    graphql.ExecutionInput
    Create the ExecutionInput to pass to GraphQL.

    Methods inherited from interface org.springframework.graphql.GraphQlRequest

    getDocument, getExtensions, getOperationName, getVariables, toMap
  • Field Details

    • ALL_OPERATIONS

      static final Set<graphql.language.OperationDefinition.Operation> ALL_OPERATIONS
      All operation types supported by GraphQL.
      Since:
      2.1.0
  • Method Details

    • getId

      String getId()
      Return the transport assigned id for the request that in turn sets executionId.

      By default, the id is initialized as follows:

      • On WebFlux, this is the ServerHttpRequest id which correlates to WebFlux log messages. For Reactor Netty, it also correlates to server log messages.
      • On Spring MVC, the id is generated via AlternativeJdkIdGenerator, which does not correlate to anything, but is more efficient than the default ExecutionIdProvider which relies on UUID.randomUUID().
      • On WebSocket, the id is set to the message id of the "subscribe" message from the GraphQL over WebSocket protocol that is used to correlate request and response messages on the the WebSocket.

      To override this id, use executionId(ExecutionId) or configure GraphQL with an ExecutionIdProvider.

      Returns:
      the request id
    • executionId

      void executionId(graphql.execution.ExecutionId executionId)
      Configure the ExecutionId to set on ExecutionInput.getExecutionId(), overriding the transport assigned id.
      Parameters:
      executionId - the id to use
    • getExecutionId

      @Nullable graphql.execution.ExecutionId getExecutionId()
      Return the configured executionId.
    • getLocale

      @Nullable Locale getLocale()
      Return the transport assigned locale value, if any.
    • getAllowedOperations

      default Set<graphql.language.OperationDefinition.Operation> getAllowedOperations()
      Return the GraphQL operation types that may be executed for this request. Transports use this to reflect protocol-level constraints, e.g. HTTP safe methods must not execute mutations. Defaults to all operation types.
      Since:
      2.1.0
    • allowedOperations

      default void allowedOperations(Set<graphql.language.OperationDefinition.Operation> operations)
      Restrict the operation types that may be executed for this request.
      Parameters:
      operations - the operation types allowed for this request
      Since:
      2.1.0
    • configureExecutionInput

      void configureExecutionInput(BiFunction<graphql.ExecutionInput, graphql.ExecutionInput.Builder, graphql.ExecutionInput> configurer)
      Provide a BiFunction to help initialize the ExecutionInput passed to GraphQL. The ExecutionInput is first pre-populated with values from "this" ExecutionGraphQlRequest, and is then customized with the functions provided here.
      Parameters:
      configurer - a BiFunction that accepts the ExecutionInput initialized so far, and a builder to customize it.
    • toExecutionInput

      graphql.ExecutionInput toExecutionInput()
      Create the ExecutionInput to pass to GraphQL. passed to GraphQL. The ExecutionInput is populated with values from "this" ExecutionGraphQlRequest, and then customized with functions provided via configureExecutionInput(BiFunction).
      Returns:
      the resulting ExecutionInput