graphql_resolver_map.proto

Package : apimanagement.gloo.solo.io

Top

graphql_resolver_map.proto

Table of Contents

DynamicMetadataExtraction

Field Type Label Description
metadataNamespace string The envoy dynamic metadata namespace that the data lives in. If the namespace doesn't exist in the metadata, the extraction yields null
key string The key under the envoy dynamic metadata namespace that the data lives under. If the key doesn't exist in the namespace, the extraction yields null

ExecutableSchema

Note: This is not it's own separate Resource, but this message is used in Route Table and GraphQL Stitched Schema. The ExecutableSchema contains all the information needed to execute a schema by itself. The execution can be done locally via resolver maps, or on a remote GraphQL instance, via a graphql server.

Field Type Label Description
schemaRef core.skv2.solo.io.ClusterObjectRef Required: Reference to the GraphQLSchema object which contains the GraphQL SDL defining this GraphQL schema.
server apimanagement.gloo.solo.io.ExecutableSchema.GraphQLServer Configuration to delegate resolving this GraphQL request to an external GraphQL server, which can be another GlooGraphQL instance or another instance of a GraphQL server. The external GraphQL server must be compliant with the June 2018 GraphQL specification.
local apimanagement.gloo.solo.io.ExecutableSchema.Local List of references to GraphQLResolverMap resources. GraphQLResolverMaps contain a mapping from GraphQL fields to resolver configuration, so that those fields can be resolved locally by this GraphQL-envoy instance. Order of the references listed below does matter as resolver maps listed first will be given priority over later ones when tie-breaking field resolver configurations.

ExecutableSchema.GraphQLServer

Field Type Label Description
graphqlServers []common.gloo.solo.io.DestinationReference repeated List of destinations that can server GraphQL requests. The external GraphQL server must be compliant with the June 2018 GraphQL specification. Though this is a list, only the first referenced destination will be used until fail-over and load balancing is supported between multiple GraphQL destinations.
variables []apimanagement.gloo.solo.io.ExecutableSchema.GraphQLServer.VariablesEntry repeated Declare variables that are used in variable transformations in the fields below for the GraphQL request to a remote server. The keys to this map are the name of the variables. See the variable transformations specifically for how to reference these variables.
headers []apimanagement.gloo.solo.io.ExecutableSchema.GraphQLServer.HeadersEntry repeated map of header name to a transformation on extracted variables which are declared in the variables field. The transformation must result in a string value, or an error will be sent back to the client.
queryParams []apimanagement.gloo.solo.io.ExecutableSchema.GraphQLServer.QueryParamsEntry repeated map of query parameter name to a transformation on extracted variables which are declared in the variables field. The transformation must result in a string value, or an error will be sent back to the client.
spanName string The span name for the remote GraphQL request, used for tracing. If left empty or not set, the request span name will be set to the upstream cluster name.

ExecutableSchema.GraphQLServer.HeadersEntry

Field Type Label Description
key string
value apimanagement.gloo.solo.io.VariableTransformation

ExecutableSchema.GraphQLServer.QueryParamsEntry

Field Type Label Description
key string
value apimanagement.gloo.solo.io.VariableTransformation

ExecutableSchema.GraphQLServer.RequestExtraction

Field Type Label Description
dynamicMetadata apimanagement.gloo.solo.io.DynamicMetadataExtraction Extract the value from envoy dynamic metadata. The extracted value is an object.
requestHeader string Extract the value from the GraphQL HTTP request header. The extracted value is a string. If the header doesn't exist, an empty string will be used.
jsonValue google.protobuf.Value Assigns the variable to a JSON value specified here.

ExecutableSchema.GraphQLServer.VariablesEntry

Field Type Label Description
key string
value apimanagement.gloo.solo.io.ExecutableSchema.GraphQLServer.RequestExtraction

ExecutableSchema.Local

Field Type Label Description
resolverMapRefs []core.skv2.solo.io.ClusterObjectRef repeated List of references to GraphQLResolverMap resources. GraphQLResolverMaps contain a mapping from GraphQL fields to resolver configuration, so that those fields can be resolved locally by this GraphQL-envoy instance. Order of the references listed below does matter as resolver maps listed first will be given priority over later ones when tie-breaking field resolver configurations.
options apimanagement.gloo.solo.io.ExecutableSchema.Local.Options

ExecutableSchema.Local.Options

Field Type Label Description
maxDepth google.protobuf.UInt32Value Max GraphQL operation (query/mutation/subscription) depth. This sets a limitation on the max nesting on a query that runs against this schema. any GraphQL operation that runs past the max_depth will add an error message to the response and will return as null. As as simple example, if the schema is gql type Query { employee: Employee }<br>type Employee { manager: Employee name: String } and we set a max_depth of 3 and we run a query gql query { # query depth : 0 employee { # query depth : 1 manager { # query depth : 2 name # query depth : 3 manager { # query depth : 3 name # query depth : 4 } } } } the graphql server will respond with a response: ```json { “data” : { “employee” : { “manager” : { “name” : “Manager 1”, “manager” : { “name” : null }}}}, “errors”: [ {“message”: “field ‘name’ exceeds the max operation depth of 3 for this schema”} ] } If not configured, or the value is 0, the query depth will be unbounded. |
enableIntrospection bool Do we enable introspection for the schema? general recommendation is to disable this for production and hence it defaults to false.

Extraction

Extractions are used to assign values to variables from various sources of data in the GraphQL request or response. This includes HTTP headers, Envoy Dynamic Metadata, or GraphQL query-specific args.

Field Type Label Description
requestHeader string Extract the value from the GraphQL HTTP request header. The extracted value is a string. If the header doesn't exist, an empty string will be used.
dynamicMetadata apimanagement.gloo.solo.io.DynamicMetadataExtraction Extract the value from envoy dynamic metadata. The extracted value is an object.
graphqlParent google.protobuf.Empty Assigns the variable to the parent object
graphqlArg string Assigns the variable to the GraphQL Argument with this name. If this name doesn't exist, the variable is null
resolverResult google.protobuf.Empty Assigns the variable to the GraphQL resolver result. If this Extraction is used in a place where the resolver result is not available, an error will be thrown during configuration time.
jsonValue google.protobuf.Value Assigns the variable to a JSON value specified here

GraphQLResolverMapSpec

The GraphQLResolverMap Resource contains a mapping from types to fields to resolutions. For example, for a schema with type Query and field GetName graphql type Query { GetName: String } you can configure a resolver for the GetName field as follows: yaml types: Query: fields: GetName: <insert resolver config>

Field Type Label Description
types []apimanagement.gloo.solo.io.GraphQLResolverMapSpec.TypesEntry repeated Map of GraphQL types to field resolutions. The key must match the GraphQL type name and is case-sensitive. Every field under GraphQL root types (Query, Mutation) must have a resolver defined.

GraphQLResolverMapSpec.Resolution

Field Type Label Description
fields []apimanagement.gloo.solo.io.GraphQLResolverMapSpec.Resolution.FieldsEntry repeated Map of GraphQL fields for the type to resolutions. The key must match the GraphQL field name and is case-sensitive. Fields that don't have resolvers will use the GraphQL default resolver, which returns the field in the parent object with the same name as the GraphQL field.

GraphQLResolverMapSpec.Resolution.FieldsEntry

Field Type Label Description
key string
value apimanagement.gloo.solo.io.GraphQLResolverMapSpec.Resolution.Resolvers

GraphQLResolverMapSpec.Resolution.Resolvers

Field Type Label Description
resolvers []apimanagement.gloo.solo.io.GraphQLResolverMapSpec.Resolution.Resolvers.Resolver repeated List of resolvers. Currently, only one the first resolver configuration will be respected and a warning will be thrown if more than one resolver is in the list.
variables []apimanagement.gloo.solo.io.GraphQLResolverMapSpec.Resolution.Resolvers.VariablesEntry repeated Variables that can be used as a part of transformations for this field's resolution. The key is the name of the variable, which is directly used in the transformation. The value defines where the variable value is extracted from on the GraphQL request.
statPrefix google.protobuf.StringValue The stats prefix which will be used for this resolver. If empty, will generate a stats prefix ${RESOLVER_NAME}

GraphQLResolverMapSpec.Resolution.Resolvers.Resolver

Field Type Label Description
restResolver apimanagement.gloo.solo.io.GraphQLResolverMapSpec.Resolution.Resolvers.Resolver.RestResolver Resolves values by making a HTTP/2 request to a HTTP/REST destination.
resolverResultTransform apimanagement.gloo.solo.io.VariableTransformation Use a transformation on extracted variables to transform the upstream REST response. By default, the transformation is empty and the destination response is left as is before being passed into the GraphQL execution engine.

GraphQLResolverMapSpec.Resolution.Resolvers.Resolver.RestResolver

Field Type Label Description
destinations []common.gloo.solo.io.DestinationReference repeated Required: list of destinations which point to destinations containing a RESTful service. Must provide at least one destination.
(Note: only the first destination will be used)
request apimanagement.gloo.solo.io.GraphQLResolverMapSpec.Resolution.Resolvers.Resolver.RestResolver.RequestTemplate Configuration to template a HTTP request to fetch JSON from a destination REST service. This includes configuration such as setting headers dynamically on the HTTP request, configuring query_params, and setting the body for the request to the destination.
variables []apimanagement.gloo.solo.io.GraphQLResolverMapSpec.Resolution.Resolvers.Resolver.RestResolver.VariablesEntry repeated Variables that can be used in this field's response transform. The key is the name of the variable, which is directly used in the transformation. The value defines where the variable value is extracted from on the GraphQL REST response.
spanName google.protobuf.StringValue The span name for the upstream REST request, used for tracing. If left empty or not set, the request span name will be set to the upstream cluster name.
timeout google.protobuf.Duration Set the timeout of the HTTP request to the REST service (default 5s)

GraphQLResolverMapSpec.Resolution.Resolvers.Resolver.RestResolver.RESTVariable

Field Type Label Description
responseHeader string Only available on response transformations Extract the value from the GraphQL HTTP response header. The extracted value is a string. If this Extraction is used in a place where response headers are not available, an error will be thrown during configuration time.

GraphQLResolverMapSpec.Resolution.Resolvers.Resolver.RestResolver.RequestTemplate

Field Type Label Description
headers []apimanagement.gloo.solo.io.GraphQLResolverMapSpec.Resolution.Resolvers.Resolver.RestResolver.RequestTemplate.HeadersEntry repeated Sets the headers on the request to the REST destination. This includes setting HTTP :path header. This is a map of HTTP Header name to a transformation which determines the Header value. The transformation must result in a string value, or an error will be sent back to the client. By default, the :method header is set to GET. If body is set, then the :method is POST. This can be overridden by setting the :method header manually below.
queryParams []apimanagement.gloo.solo.io.GraphQLResolverMapSpec.Resolution.Resolvers.Resolver.RestResolver.RequestTemplate.QueryParamsEntry repeated Sets the query parameters on the request to the REST destination. The transformation must result in a string value, or an error will be sent back to the client.
body apimanagement.gloo.solo.io.VariableTransformation Sets the outgoing body to the upstream REST destination. By default, the body is empty.

GraphQLResolverMapSpec.Resolution.Resolvers.Resolver.RestResolver.RequestTemplate.HeadersEntry

Field Type Label Description
key string
value apimanagement.gloo.solo.io.VariableTransformation

GraphQLResolverMapSpec.Resolution.Resolvers.Resolver.RestResolver.RequestTemplate.QueryParamsEntry

Field Type Label Description
key string
value apimanagement.gloo.solo.io.VariableTransformation

GraphQLResolverMapSpec.Resolution.Resolvers.Resolver.RestResolver.VariablesEntry

Field Type Label Description
key string
value apimanagement.gloo.solo.io.GraphQLResolverMapSpec.Resolution.Resolvers.Resolver.RestResolver.RESTVariable

GraphQLResolverMapSpec.Resolution.Resolvers.VariablesEntry

Field Type Label Description
key string
value apimanagement.gloo.solo.io.Extraction

GraphQLResolverMapSpec.TypesEntry

Field Type Label Description
key string
value apimanagement.gloo.solo.io.GraphQLResolverMapSpec.Resolution

GraphQLResolverMapStatus

Field Type Label Description
global common.gloo.solo.io.GenericGlobalStatus
workspaces []apimanagement.gloo.solo.io.GraphQLResolverMapStatus.WorkspacesEntry repeated The status of the resource in each workspace that it exists in.
ownerWorkspace common.gloo.solo.io.OwnerWorkspace Name of Workspace that owns the GraphQLResolverMap

GraphQLResolverMapStatus.WorkspacesEntry

Field Type Label Description
key string
value common.gloo.solo.io.WorkspaceStatus

VariableTransformation

Variable transformations are used to take variables that were declared and transform them using a transformation. The simplest transformation is the variable transform, which passes through the value of a single variable. For more complex transforms, the jq transformation can be used to form more complicated JSON values.

Field Type Label Description
variable string The name of a variable declared in the variables field. The value of the variable is returned with no transformation.
jq string The jq filter which is used to provide a value. variables defined in variables can be used in the jq filter via regular jq variable syntax. For example, a variable named “userIdHeader” can be used in a jq filter as $userIdHeader Jq filters must only result in one value, or an error will be sent back to the client. For example, for the input [1,2,3], the jq filter .[] is not a valid jq filter as it results in multiple jq results. However, the jq filter ‘.
value google.protobuf.Value Static JSON value.