graphql.proto

Package: graphql.gloo.solo.io

Types:

Source File: github.com/solo-io/gloo/projects/gloo/api/v1/enterprise/options/graphql/v1alpha1/graphql.proto

RequestTemplate

Defines a configuration for generating outgoing requests for a resolver.

"headers": map<string, string>
"queryParams": map<string, string>
"body": .google.protobuf.Value

Field Type Description
headers map<string, string> Use this attribute to set request headers to your REST service. It consists of a map of strings to templated value strings. The string key determines the name of the resulting header, the value provided will be the value. The least needed here is the “:method” and “:path” headers. for example, if a header is an authorization token, taken from the graphql args, we can use the following configuration: headers: Authorization: “Bearer {$args.token}".
queryParams map<string, string> Use this attribute to set query parameters to your REST service. It consists of a map of strings to templated value strings. The string key determines the name of the query param, the provided value will be the value. This value is appended to any value set to the :path header in headers. for example, if a query parameter is an id, taken from the graphql parent object, we can use the following configuration: queryParams: id: “{$parent.id}".
body .google.protobuf.Value Used to construct the outgoing body to the upstream from the graphql value providers. All string values can be templated strings.

ResponseTemplate

"resultRoot": string
"setters": map<string, string>

Field Type Description
resultRoot string Sets the “root” of the upstream response to be turned into a graphql type by the graphql server. For example, if the graphql type is: type Simple { name String } and the upstream response is {"data": {"simple": {"name": "simple name"}}}, the graphql server will not be able to marshal the upstream response into the Simple graphql type because it doesn’t know where the relevant data is. If we set result_root to “data.simple”, we can give the graphql server a hint of where to look in the upstream response for the relevant data that graphql type wants.
setters map<string, string> Field-specific mapping for a graphql field to a JSON path in the upstream response. For example, if the graphql type is type Simple { name String number String } and the upstream response is {"name": "simple name", "details": {"num": "1234567890"}}, the graphql server will not be able to marshal the upstream response into the Simple graphql type because of the nested number field. We can use a simple setter here: setters: number: “details.num” and the graphql server will be able to extract data for a field given the path to the relevant data in the upstream JSON response. We don’t need to have a setter for the name field because the JSON response has that field in a position the graphql server can understand automatically.

GrpcRequestTemplate

Defines a configuration for generating outgoing requests for a resolver.

"outgoingMessageJson": .google.protobuf.Value
"serviceName": string
"methodName": string
"requestMetadata": map<string, string>

Field Type Description
outgoingMessageJson .google.protobuf.Value json representation of outgoing gRPC message to be sent to gRPC service.
serviceName string request has shape matching service with name registered in registry is the full_name(), e.g. main.Bookstore.
methodName string make request to method with this name on the grpc service defined above is just the name(), e.g. GetBook.
requestMetadata map<string, string> in the future, we may want to make this a map<string, ValueProvider> once we know better what the use cases are.

RESTResolver

control-plane API

"upstreamRef": .core.solo.io.ResourceRef
"request": .graphql.gloo.solo.io.RequestTemplate
"response": .graphql.gloo.solo.io.ResponseTemplate
"spanName": string

Field Type Description
upstreamRef .core.solo.io.ResourceRef
request .graphql.gloo.solo.io.RequestTemplate configuration used to compose the outgoing request to a REST API.
response .graphql.gloo.solo.io.ResponseTemplate configuration used to modify the response from the REST API before being handled by the graphql server.
spanName string

GrpcDescriptorRegistry

Defines a configuration for serializing and deserializing requests for a gRPC resolver. Is a Schema Extension

"protoDescriptor": string
"protoDescriptorBin": bytes

Field Type Description
protoDescriptor string Supplies the filename of :ref:the proto descriptor set <config_grpc_json_generate_proto_descriptor_set> for the gRPC services. Only one of protoDescriptor or protoDescriptorBin can be set.
protoDescriptorBin bytes Supplies the binary content of :ref:the proto descriptor set <config_grpc_json_generate_proto_descriptor_set> for the gRPC services. Note: in yaml, this must be provided as a base64 standard encoded string; yaml can’t handle binary bytes. Only one of protoDescriptorBin or protoDescriptor can be set.

GrpcResolver

control-plane API

"upstreamRef": .core.solo.io.ResourceRef
"requestTransform": .graphql.gloo.solo.io.GrpcRequestTemplate
"spanName": string

Field Type Description
upstreamRef .core.solo.io.ResourceRef
requestTransform .graphql.gloo.solo.io.GrpcRequestTemplate configuration used to compose the outgoing request to a REST API.
spanName string

QueryMatcher

"fieldMatcher": .graphql.gloo.solo.io.QueryMatcher.FieldMatcher

Field Type Description
fieldMatcher .graphql.gloo.solo.io.QueryMatcher.FieldMatcher

FieldMatcher

"type": string
"field": string

Field Type Description
type string Object type. For example, Query.
field string Field with in the object.

Resolution

Define a resolution for each (Type).(Field) If a field does not have resolver, the default resolver will be used. the default resolver takes the field with the same name from the parent, and uses that value to resolve the field. If a field with the same name does not exist in the parent, null will be used.

"matcher": .graphql.gloo.solo.io.QueryMatcher
"restResolver": .graphql.gloo.solo.io.RESTResolver
"grpcResolver": .graphql.gloo.solo.io.GrpcResolver

Field Type Description
matcher .graphql.gloo.solo.io.QueryMatcher Match an object type and field.
restResolver .graphql.gloo.solo.io.RESTResolver Only one of restResolver or grpcResolver can be set.
grpcResolver .graphql.gloo.solo.io.GrpcResolver Only one of grpcResolver or restResolver can be set.

GraphQLSchema

Enterprise-Only: THIS FEATURE IS IN TECH PREVIEW. APIs are versioned as alpha and subject to change. User-facing CR config for resolving client requests to graphql schemas. Routes that have this config will execute graphql queries, and will not make it to the router filter. i.e. this filter will terminate the request for these routes. Note: while users can provide this configuration manually, the eventual UX will be to generate the Executable Schema CRs from other sources and just have users configure the routes to point to these schema CRs.

"namespacedStatuses": .core.solo.io.NamespacedStatuses
"metadata": .core.solo.io.Metadata
"executableSchema": .graphql.gloo.solo.io.ExecutableSchema

Field Type Description
namespacedStatuses .core.solo.io.NamespacedStatuses NamespacedStatuses indicates the validation status of this resource. NamespacedStatuses is read-only by clients, and set by gloo during validation.
metadata .core.solo.io.Metadata Metadata contains the object metadata for this resource.
executableSchema .graphql.gloo.solo.io.ExecutableSchema

ExecutableSchema

"schemaDefinition": string
"executor": .graphql.gloo.solo.io.Executor
"grpcDescriptorRegistry": .graphql.gloo.solo.io.GrpcDescriptorRegistry

Field Type Description
schemaDefinition string Schema to use in string format.
executor .graphql.gloo.solo.io.Executor how to execute the schema.
grpcDescriptorRegistry .graphql.gloo.solo.io.GrpcDescriptorRegistry Schema extensions.

Executor

"local": .graphql.gloo.solo.io.Executor.Local

Field Type Description
local .graphql.gloo.solo.io.Executor.Local

Local

Execute schema using resolvers.

"resolutions": []graphql.gloo.solo.io.Resolution
"enableIntrospection": bool

Field Type Description
resolutions []graphql.gloo.solo.io.Resolution The resolver map to use to resolve the schema.
enableIntrospection bool Do we enable introspection for the schema? general recommendation is to disable this for production and hence it defaults to false.