The documentation you are viewing is for Dapr v1.4 which is an older version of Dapr. For up-to-date documentation, see the latest version.

GraphQL binding spec

Detailed documentation on the GraphQL binding component

Component format

To setup GraphQL binding create a component of type bindings.graphql. See this guide on how to create and apply a binding configuration. To separate normal config settings (e.g. endpoint) from headers, “header:” is used a prefix on the header names.

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: example.bindings.graphql
spec:
  type: bindings.graphql
  version: v1
  metadata:
    - name: endpoint
      value:  http://localhost:8080/v1/graphql
    - name: header:x-hasura-access-key
      value: adminkey
    - name: header:Cache-Control
      value: no-cache

Spec metadata fields

Field Required Binding support Details Example
endpoint Y Output GraphQL endpoint string See here for more details "http://localhost:4000/graphql/graphql"
header:[HEADERKEY] N Output GraphQL header. Specify the header key in the name, and the header value in the value. "no-cache" (see above)

Endpoint and Header format

The GraphQL binding uses GraphQL client internally.

Binding support

This component supports output binding with the following operations:

  • query
  • mutation

query

The query operation is used for query statements, which returns the metadata along with data in a form of an array of row values.

Request

in := &dapr.InvokeBindingRequest{
Name:      "example.bindings.graphql",
Operation: "query",
Metadata: map[string]string{ "query": `query { users { name } }`},
}

Last modified July 12, 2022 : update nav bar for v1.4 (#2641) (2db803e)