Absinthe.Plug.DocumentProvider behaviour (absinthe_plug v1.5.8) View Source

A document provider is a module that, given a GraphQL query, determines what document should be executed and how the configured pipeline should be applied to that document.

Configuring

Configuration of your document providers occurs on initialization of Absinthe.Plug; see that module's documentation of the :document_providers option for more details.

Making Your Own

Absinthe.Plug.DocumentProvider is a behaviour, and any module that implements its callbacks can function as a document provider for Absinthe.Plug.

See the documentation for the behaviour callbacks and the implementation of the document providers that are defined in this package for more information.

Link to this section Summary

Types

When the request is not handled by this document provider (so processing should continue to the next one)

t()

A configuration for a document provider, which can take two forms

Callbacks

Given a request, determine what part of its configured pipeline should be applied during execution.

Given a request, attempt to process it with this document provider.

Link to this section Types

Specs

result() ::
  {:halt, Absinthe.Plug.Request.Query.t()}
  | {:cont, Absinthe.Plug.Request.Query.t()}

When the request is not handled by this document provider (so processing should continue to the next one):

{:cont, Absinthe.Plug.Request.Query.t}

When the request has been processed by this document provider:

{:halt, Absinthe.Plug.Request.Query.t}

Note that if no document providers set the request document, no document execution will occur and an error will be returned to the client.

Specs

t() :: module() | {module(), Keyword.t()}

A configuration for a document provider, which can take two forms:

  • module when options do not need to be passed to the document provider.
  • {module, Keyword.t} when options are needed by the document provider.

Link to this section Callbacks

Specs

pipeline(Absinthe.Plug.Request.Query.t()) :: Absinthe.Pipeline.t()

Given a request, determine what part of its configured pipeline should be applied during execution.

Specs

process(Absinthe.Plug.Request.Query.t(), Keyword.t()) :: result()

Given a request, attempt to process it with this document provider.

Return Types

See the documentation for the Absinthe.Plug.DocumentProvider.result type.