Dagger GraphQL API Reference
Queries
cacheVolume
Description
Constructs a cache volume for a given cache key.
Type
Arguments
Name | Description |
---|---|
key - String!
|
A string identifier to target this cache volume (e.g., "modules-cache"). |
checkVersionCompatibility
Description
Checks if the current Dagger Engine is compatible with an SDK's required version.
Example
container
Description
Creates a scratch container or loads one by ID.
Optional platform argument initializes new containers to execute and publish as that platform. Platform defaults to that of the builder's host.
Type
Arguments
Name | Description |
---|---|
id - ContainerID
|
Use
loadContainerFromID instead. |
platform - Platform
|
Example
query {
container {
from(address: "alpine") {
defaultArgs
entrypoint
platform
rootfs {
entries
}
}
}
}
currentFunctionCall
Description
The FunctionCall context that the SDK caller is currently executing in. If the caller is not currently executing in a function, this will return an error.
Type
Example
currentModule
Description
The module currently being served in the session, if any.
Type
Example
defaultPlatform
Description
The default platform of the builder.
Type
directory
Description
Creates an empty directory or loads one by ID.
Type
Arguments
Name | Description |
---|---|
id - DirectoryID
|
Use
loadDirectoryFromID instead. |
Example
query {
directory {
withNewDirectory(path: "foo") {
withNewDirectory(path: "foo/bar/baz") {
withNewFile(path: "foo/bar/greeting", contents: "hello, world!\n") {
foo: entries(path: "foo")
bar: entries(path: "foo/bar")
greeting: file(path: "foo/bar/greeting") {
contents
}
}
}
}
}
}
file
loadFileFromID
instead. Description
Loads a file by ID.
Example
query {
file(id: "eyJsbGIiOnsiZGVmIjpbIklqWVNOQWovLy8vLy8vLy8vLzhCRVAvLy8vLy8vLy8vL3dFcUhBb0VMMlp2YnhDa0F4b0dTR1ZzYkc4aEtQLy8vLy8vLy8vLy93RlNBRm9BIiwiQ2trS1IzTm9ZVEkxTmpwak1EQTVPV1U1TURrNFpEVmlObUkyWVdWaFpXWXpObVpsTnpsaU9UUTVOVEF4TnpoalptRmpPRGxsWVdKbE5XRmtZbUprTkdZeFptWXdNV0l3TkdWbSJdLCJtZXRhZGF0YSI6eyJzaGEyNTY6NWNjOGQ1M2VkZTRjYzUyODQ0OTIyYWFhZDlhYjIzMzc3MzY3NWMwMDJjOTM5NGZhYTk0OTg1OTZmNGFjMWRiNiI6eyJjYXBzIjp7ImNvbnN0cmFpbnRzIjp0cnVlLCJwbGF0Zm9ybSI6dHJ1ZX19LCJzaGEyNTY6YzAwOTllOTA5OGQ1YjZiNmFlYWVmMzZmZTc5Yjk0OTUwMTc4Y2ZhYzg5ZWFiZTVhZGJiZDRmMWZmMDFiMDRlZiI6eyJjYXBzIjp7ImZpbGUuYmFzZSI6dHJ1ZX19fSwiU291cmNlIjp7ImxvY2F0aW9ucyI6eyJzaGEyNTY6YzAwOTllOTA5OGQ1YjZiNmFlYWVmMzZmZTc5Yjk0OTUwMTc4Y2ZhYzg5ZWFiZTVhZGJiZDRmMWZmMDFiMDRlZiI6e319fX0sImZpbGUiOiJmb28iLCJwbGF0Zm9ybSI6eyJhcmNoaXRlY3R1cmUiOiIiLCJvcyI6IiJ9fQ==") {
contents
export(path: "greeting")
}
}
function
Description
Create a function.
Type
Arguments
Name | Description |
---|---|
name - String!
|
|
returnType - TypeDefID!
|
Example
generatedCode
Description
Create a code generation result, given a directory containing the generated code.
Type
Arguments
Name | Description |
---|---|
code - DirectoryID!
|
Example
git
Description
Queries a git repository.
Type
Arguments
Name | Description |
---|---|
url - String!
|
Url of the git repository. Can be formatted as https://{host}/{owner}/{repo}, git@{host}:{owner}/{repo} Suffix ".git" is optional. |
keepGitDir - Boolean
|
Set to true to keep .git directory. |
sshKnownHosts - String
|
Set SSH known hosts |
sshAuthSocket - SocketID
|
Set SSH auth socket |
experimentalServiceHost - ServiceID
|
A service which must be started before the repo is fetched. |
Example
query {
git(url: "https://github.com/dagger/dagger", keepGitDir: true) {
branch(name: "main") {
tree {
file(path: ".git/refs/heads/main") {
contents
}
}
}
}
}
host
Description
Queries the host environment.
Type
Example
query {
host {
read: directory(path: ".") {
file(path: ".markdownlint.yaml") {
contents
}
}
home: envVariable(name: "HOME") {
value
}
pwd: envVariable(name: "PWD") {
value
}
write: directory(path: ".") {
withNewFile(path: "greeting", contents: "Hello Dagger!") {
export(path: ".")
}
}
}
}
http
Description
Returns a file containing an http remote url content.
Type
Arguments
Name | Description |
---|---|
url - String!
|
HTTP url to get the content from (e.g., "https://docs.dagger.io"). |
experimentalServiceHost - ServiceID
|
A service which must be started before the URL is fetched. |
loadCacheVolumeFromID
Description
Load a CacheVolume from its ID.
Type
Arguments
Name | Description |
---|---|
id - CacheVolumeID!
|
Example
loadContainerFromID
Description
Loads a container from an ID.
Type
Arguments
Name | Description |
---|---|
id - ContainerID!
|
Example
loadDirectoryFromID
Description
Load a Directory from its ID.
Type
Arguments
Name | Description |
---|---|
id - DirectoryID!
|
Example
loadFileFromID
Description
Load a File from its ID.
Example
loadFunctionArgFromID
Description
Load a function argument by ID.
Type
Arguments
Name | Description |
---|---|
id - FunctionArgID!
|
Example
loadFunctionFromID
Description
Load a function by ID.
Type
Arguments
Name | Description |
---|---|
id - FunctionID!
|
Example
loadGeneratedCodeFromID
Description
Load a GeneratedCode by ID.
Type
Arguments
Name | Description |
---|---|
id - GeneratedCodeID!
|
Example
loadModuleFromID
Description
Load a module by ID.
Example
loadSecretFromID
Description
Load a Secret from its ID.
Example
loadServiceFromID
Description
Loads a service from ID.
Type
Arguments
Name | Description |
---|---|
id - ServiceID!
|
Example
loadSocketFromID
Description
Load a Socket from its ID.
Example
loadTypeDefFromID
Description
Load a TypeDef by ID.
Type
Arguments
Name | Description |
---|---|
id - TypeDefID!
|
Example
module
Description
Create a new module.
Type
Example
moduleConfig
Description
Load the static configuration for a module from the given source directory and optional subpath.
Type
Arguments
Name | Description |
---|---|
sourceDirectory - DirectoryID!
|
|
subpath - String
|
Example
pipeline
Description
Creates a named sub-pipeline.
Type
Arguments
Name | Description |
---|---|
name - String!
|
Pipeline name. |
description - String
|
Pipeline description. |
labels - [PipelineLabel!]
|
Pipeline labels. |
Example
query {
pipeline(name: "build", description: "Builds the app container") {
container {
id
}
}
}
secret
loadSecretFromID
instead Description
Loads a secret from its ID.
Example
query {
secret(id: "eyJob3N0X2VudiI6IkhPTUUifQ==") {
plaintext
}
}
setSecret
Description
Sets a secret given a user defined name to its plaintext and returns the secret. The plaintext value is limited to a size of 128000 bytes.
Example
socket
loadSocketFromID
instead. Description
Loads a socket by its ID.
Example
query {
socket(id: "eyJob3N0X3BhdGgiOiIvdmFyL3J1bi9kb2NrZXIuc29jayJ9") {
id
}
}
typeDef
Description
Create a new TypeDef.
Type
Example
Types
Boolean
Description
The Boolean
scalar type represents true
or false
.
BuildArg
CacheSharingMode
Description
Sharing mode of the cache volume.
Values
Enum Value | Description |
---|---|
|
Shares the cache volume amongst many build pipelines |
|
Keeps a cache volume for a single build pipeline |
|
Shares the cache volume amongst many build pipelines, but will serialize the writes |
Example
"SHARED"
CacheVolume
Description
A directory whose contents persist across runs.
Fields
Field Name | Description |
---|---|
id - CacheVolumeID! |
CacheVolumeID
Description
A global cache volume identifier.
Container
Description
An OCI-compatible container, also known as a docker container.
Fields
Field Name | Description |
---|---|
id - ContainerID! |
A unique identifier for this container. |
sync - ContainerID! |
Forces evaluation of the pipeline in the engine. It doesn't run the default command if no exec has been set. |
platform - Platform! |
The platform this container executes and publishes as. |
pipeline - Container! |
Creates a named sub-pipeline |
Arguments
|
|
from - Container! |
Initializes this container from a pulled base image. |
Arguments
|
|
build - Container! |
Initializes this container from a Dockerfile build. |
Arguments
|
|
rootfs - Directory! |
Retrieves this container's root filesystem. Mounts are not included. |
withRootfs - Container! |
Initializes this container from this DirectoryID. |
Arguments
|
|
directory - Directory! |
Retrieves a directory at the given path. Mounts are included. |
Arguments
|
|
file - File! |
Retrieves a file at the given path. Mounts are included. |
Arguments
|
|
user - String |
Retrieves the user to be set for all commands. |
withUser - Container! |
Retrieves this container with a different command user. |
Arguments
|
|
workdir - String |
Retrieves the working directory for all commands. |
withWorkdir - Container! |
Retrieves this container with a different working directory. |
Arguments
|
|
envVariables - [EnvVariable!]! |
Retrieves the list of environment variables passed to commands. |
envVariable - String |
Retrieves the value of the specified environment variable. |
Arguments
|
|
withEnvVariable - Container! |
Retrieves this container plus the given environment variable. |
Arguments |
|
labels - [Label!]! |
Retrieves the list of labels passed to container. |
label - String |
Retrieves the value of the specified label. |
Arguments
|
|
withLabel - Container! |
Retrieves this container plus the given label. |
withoutLabel - Container! |
Retrieves this container minus the given environment label. |
Arguments
|
|
withSecretVariable - Container! |
Retrieves this container plus an env variable containing the given secret. |
withoutEnvVariable - Container! |
Retrieves this container minus the given environment variable. |
Arguments
|
|
entrypoint - [String!] |
Retrieves entrypoint to be prepended to the arguments of all commands. |
withEntrypoint - Container! |
Retrieves this container but with a different command entrypoint. |
Arguments
|
|
defaultArgs - [String!] |
Retrieves default arguments for future commands. |
withDefaultArgs - Container! |
Configures default arguments for future commands. |
Arguments
|
|
mounts - [String!]! |
Retrieves the list of paths where a directory is mounted. |
withMountedDirectory - Container! |
Retrieves this container plus a directory mounted at the given path. |
Arguments
|
|
withMountedFile - Container! |
Retrieves this container plus a file mounted at the given path. |
Arguments
|
|
withMountedTemp - Container! |
Retrieves this container plus a temporary directory mounted at the given path. |
Arguments
|
|
withMountedCache - Container! |
Retrieves this container plus a cache volume mounted at the given path. |
Arguments
|
|
withMountedSecret - Container! |
Retrieves this container plus a secret mounted into a file at the given path. |
Arguments
|
|
withoutMount - Container! |
Retrieves this container after unmounting everything at the given path. |
Arguments
|
|
withFile - Container! |
Retrieves this container plus the contents of the given file copied to the given path. |
Arguments |
|
withNewFile - Container! |
Retrieves this container plus a new file written at the given path. |
Arguments
|
|
withDirectory - Container! |
Retrieves this container plus a directory written at the given path. |
Arguments
|
|
withUnixSocket - Container! |
Retrieves this container plus a socket forwarded to the given Unix socket path. |
Arguments
|
|
withoutUnixSocket - Container! |
Retrieves this container with a previously added Unix socket removed. |
Arguments
|
|
withFocus - Container! |
Indicate that subsequent operations should be featured more prominently in the UI. |
withoutFocus - Container! |
Indicate that subsequent operations should not be featured more prominently in the UI. This is the initial state of all containers. |
withExec - Container! |
Retrieves this container after executing the specified command inside it. |
Arguments
|
|
stdout - String! |
The output stream of the last executed command. Will execute default command if none is set, or error if there's no default. |
stderr - String! |
The error stream of the last executed command. Will execute default command if none is set, or error if there's no default. |
publish - String! |
Publishes this container as a new image to the specified address. Publish returns a fully qualified ref. It can also publish platform variants. |
Arguments
|
|
export - Boolean! |
Writes the container as an OCI tarball to the destination file path on the host for the specified platform variants. Return true on success. It can also publishes platform variants. |
Arguments
|
|
asTarball - File! |
Returns a File representing the container serialized to a tarball. |
Arguments
|
|
import - Container! |
Reads the container from an OCI tarball. NOTE: this involves unpacking the tarball to an OCI store on the host at $XDG_CACHE_DIR/dagger/oci. This directory can be removed whenever you like. |
withRegistryAuth - Container! |
Retrieves this container with a registry authentication for a given address. |
Arguments
|
|
withoutRegistryAuth - Container! |
Retrieves this container without the registry authentication of a given address. |
Arguments
|
|
imageRef - String |
The unique image reference which can only be retrieved immediately after the 'Container.From' call. |
withExposedPort - Container! |
Expose a network port. Exposed ports serve two purposes:
|
Arguments
|
|
withoutExposedPort - Container! |
Unexpose a previously exposed port. |
Arguments
|
|
exposedPorts - [Port!]! |
Retrieves the list of exposed ports. This includes ports already exposed by the image, even if not explicitly added with dagger. |
withServiceBinding - Container! |
Establish a runtime dependency on a service. The service will be started automatically when needed and detached when it is no longer needed, executing the default command if none is set. The service will be reachable from the container via the provided hostname alias. The service dependency will also convey to any files or directories produced by the container. |
Arguments
|
|
shellEndpoint - String! |
Return a websocket endpoint that, if connected to, will start the container with a TTY streamed over the websocket. Primarily intended for internal use with the dagger CLI. |
experimentalWithGPU - Container! |
EXPERIMENTAL API! Subject to change/removal at any time. experimentalWithGPU configures the provided list of devices to be accesible to this container. This currently works for Nvidia devices only. |
Arguments
|
|
experimentalWithAllGPUs - Container! |
EXPERIMENTAL API! Subject to change/removal at any time. experimentalWithAllGPUs configures all available GPUs on the host to be accessible to this container. This currently works for Nvidia devices only. |
asService - Service! |
Turn the container into a Service. Be sure to set any exposed ports before this conversion. |
ContainerID
Description
A unique container identifier. Null designates an empty container (scratch).
Directory
Description
A directory.
Fields
Field Name | Description |
---|---|
id - DirectoryID! |
The content-addressed identifier of the directory. |
sync - DirectoryID! |
Force evaluation in the engine. |
pipeline - Directory! |
Creates a named sub-pipeline |
Arguments
|
|
entries - [String!]! |
Returns a list of files and directories at the given path. |
Arguments
|
|
glob - [String!]! |
Returns a list of files and directories that matche the given pattern. |
Arguments
|
|
file - File! |
Retrieves a file at the given path. |
Arguments
|
|
withFile - Directory! |
Retrieves this directory plus the contents of the given file copied to the given path. |
withNewFile - Directory! |
Retrieves this directory plus a new file written at the given path. |
withoutFile - Directory! |
Retrieves this directory with the file at the given path removed. |
Arguments
|
|
directory - Directory! |
Retrieves a directory at the given path. |
Arguments
|
|
withDirectory - Directory! |
Retrieves this directory plus a directory written at the given path. |
Arguments
|
|
withNewDirectory - Directory! |
Retrieves this directory plus a new directory created at the given path. |
withoutDirectory - Directory! |
Retrieves this directory with the directory at the given path removed. |
Arguments
|
|
diff - Directory! |
Gets the difference between this directory and an another directory. |
Arguments
|
|
export - Boolean! |
Writes the contents of the directory to a path on the host. |
Arguments
|
|
dockerBuild - Container! |
Builds a new Docker container from this directory. |
Arguments
|
|
withTimestamps - Directory! |
Retrieves this directory with all file/dir timestamps set to the given time. |
Arguments
|
|
asModule - Module! |
Load the directory as a Dagger module |
Arguments
|
DirectoryID
Description
A content-addressed directory identifier.
EnvVariable
FieldTypeDef
Description
A definition of a field on a custom object defined in a Module. A field on an object has a static value, as opposed to a function on an object whose value is computed by invoking code (and can accept arguments).
File
Description
A file.
Fields
Field Name | Description |
---|---|
id - FileID! |
Retrieves the content-addressed identifier of the file. |
sync - FileID! |
Force evaluation in the engine. |
contents - String! |
Retrieves the contents of the file. |
size - Int! |
Gets the size of the file, in bytes. |
export - Boolean! |
Writes the file to a file path on the host. |
withTimestamps - File! |
Retrieves this file with its created/modified timestamps set to the given time. |
Arguments
|
FileID
Description
A file identifier.
Function
Description
Function represents a resolver provided by a Module.
A function always evaluates against a parent object and is given a set of named arguments.
Fields
Field Name | Description |
---|---|
id - FunctionID! |
The ID of the function |
name - String! |
The name of the function |
returnType - TypeDef! |
The type returned by this function |
description - String |
A doc string for the function, if any |
withDescription - Function! |
Returns the function with the doc string |
Arguments
|
|
args - [FunctionArg!] |
Arguments accepted by this function, if any |
withArg - Function! |
Returns the function with the provided argument |
Arguments
|
FunctionArg
Description
An argument accepted by a function.
This is a specification for an argument at function definition time, not an argument passed at function call time.
Fields
Field Name | Description |
---|---|
id - FunctionArgID! |
The ID of the argument |
name - String! |
The name of the argument |
description - String |
A doc string for the argument, if any |
typeDef - TypeDef! |
The type of the argument |
defaultValue - JSON |
A default value to use for this argument when not explicitly set by the caller, if any |
FunctionArgID
Description
A reference to a FunctionArg.
FunctionCall
Fields
Field Name | Description |
---|---|
name - String! |
The name of the function being called. |
parentName - String! |
The name of the parent object of the function being called. If the function is "top-level" to the module, this is the name of the module. |
parent - JSON! |
The value of the parent object of the function being called. If the function is "top-level" to the module, this is always an empty object. |
inputArgs - [FunctionCallArgValue!] |
The argument values the function is being invoked with. |
returnValue - Void |
Set the return value of the function call to the provided value. The value should be a string of the JSON serialization of the return value. |
Arguments
|
FunctionCallArgValue
FunctionID
Description
A reference to a Function.
GeneratedCode
Fields
Field Name | Description |
---|---|
id - GeneratedCodeID! |
|
code - Directory! |
The directory containing the generated code |
vcsIgnoredPaths - [String!] |
List of paths to ignore in version control (i.e. .gitignore) |
withVCSIgnoredPaths - GeneratedCode! |
Set the list of paths to ignore in version control |
Arguments
|
|
vcsGeneratedPaths - [String!] |
List of paths to mark generated in version control (i.e. .gitattributes) |
withVCSGeneratedPaths - GeneratedCode! |
Set the list of paths to mark generated in version control |
Arguments
|
GeneratedCodeID
Description
A reference to GeneratedCode.
GitRef
GitRepository
Description
A git repository.
Fields
Field Name | Description |
---|---|
branch - GitRef! |
Returns details on one branch. |
Arguments
|
|
tag - GitRef! |
Returns details on one tag. |
Arguments
|
|
commit - GitRef! |
Returns details on one commit. |
Arguments
|
Host
Description
Information about the host execution environment.
Fields
Field Name | Description |
---|---|
directory - Directory! |
Accesses a directory on the host. |
file - File! |
Accesses a file on the host. |
Arguments
|
|
unixSocket - Socket! |
Accesses a Unix socket on the host. |
Arguments
|
|
tunnel - Service! |
Creates a tunnel that forwards traffic from the host to a service. |
Arguments
|
|
service - Service! |
Creates a service that forwards traffic to a specified address via the host. |
Arguments
|
|
setSecretFile - Secret! |
Sets a secret given a user-defined name and the file path on the host, and returns the secret. The file is limited to a size of 512000 bytes. |
ImageLayerCompression
Description
Compression algorithm to use for image layers.
Values
Enum Value | Description |
---|---|
|
|
|
|
|
|
|
Example
"Gzip"
ImageMediaTypes
Description
Mediatypes to use in published or exported image metadata.
Values
Enum Value | Description |
---|---|
|
|
|
Example
"OCIMediaTypes"
Int
Description
The Int
scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.
JSON
Description
An arbitrary JSON-encoded value.
Label
ListTypeDef
Description
A definition of a list type in a Module.
Fields
Field Name | Description |
---|---|
elementTypeDef - TypeDef! |
The type of the elements in the list |
Module
Fields
Field Name | Description |
---|---|
id - ModuleID! |
The ID of the module |
name - String! |
The name of the module |
description - String |
The doc string of the module, if any |
sdk - String! |
The SDK used by this module. Either a name of a builtin SDK or a module ref pointing to the SDK's implementation. |
generatedCode - GeneratedCode! |
The code generated by the SDK's runtime |
dependencies - [Module!]! |
Modules used by this module |
dependencyConfig - [String!]! |
The dependencies as configured by the module |
sourceDirectory - Directory! |
The directory containing the module's source code |
sourceDirectorySubPath - String! |
The module's subpath within the source directory |
objects - [TypeDef!] |
Objects served by this module |
withObject - Module! |
This module plus the given Object type and associated functions |
Arguments
|
|
serve - Void |
Serve a module's API in the current session. Note: this can only be called once per session. In the future, it could return a stream or service to remove the side effect. |
ModuleConfig
Description
Static configuration for a module (e.g. parsed contents of dagger.json)
Fields
Field Name | Description |
---|---|
name - String! |
The name of the module. |
root - String |
The root directory of the module's project, which may be above the module source code. |
sdk - String! |
Either the name of a built-in SDK ('go', 'python', etc.) OR a module reference pointing to the SDK's module implementation. |
include - [String!] |
Include only these file globs when loading the module root. |
exclude - [String!] |
Exclude these file globs when loading the module root. |
dependencies - [String!] |
Modules that this module depends on. |
ModuleID
Description
A reference to a Module.
NetworkProtocol
Description
Transport layer network protocol associated to a port.
Values
Enum Value | Description |
---|---|
|
TCP (Transmission Control Protocol) |
|
UDP (User Datagram Protocol) |
Example
"TCP"
ObjectTypeDef
Description
A definition of a custom object defined in a Module.
Fields
Field Name | Description |
---|---|
name - String! |
The name of the object |
description - String |
The doc string for the object, if any |
fields - [FieldTypeDef!] |
Static fields defined on this object, if any |
functions - [Function!] |
Functions defined on this object, if any |
constructor - Function |
The function used to construct new instances of this object, if any |
PipelineLabel
Platform
Description
The platform config OS and architecture in a Container.
The format is [os]/[platform]/[version] (e.g., "darwin/arm64/v7", "windows/amd64", "linux/arm64").
Port
Description
A port exposed by a container.
Fields
Field Name | Description |
---|---|
port - Int! |
The port number. |
protocol - NetworkProtocol! |
The transport layer network protocol. |
description - String |
The port description. |
PortForward
Description
Port forwarding rules for tunneling network traffic.
Fields
Input Field | Description |
---|---|
frontend - Int
|
Port to expose to clients. If unspecified, a default will be chosen. |
backend - Int!
|
Destination port for traffic. |
protocol - NetworkProtocol
|
Protocol to use for traffic. Default = TCP |
Example
{"frontend": 123, "backend": 123, "protocol": "TCP"}
Secret
SecretID
Description
A unique identifier for a secret.
Service
Fields
Field Name | Description |
---|---|
id - ServiceID! |
A unique identifier for this service. |
hostname - String! |
Retrieves a hostname which can be used by clients to reach this container. |
ports - [Port!]! |
Retrieves the list of ports provided by the service. |
endpoint - String! |
Retrieves an endpoint that clients can use to reach this container. If no port is specified, the first exposed port is used. If none exist an error is returned. If a scheme is specified, a URL is returned. Otherwise, a host:port pair is returned. |
start - ServiceID! |
Start the service and wait for its health checks to succeed. Services bound to a Container do not need to be manually started. |
stop - ServiceID! |
Stop the service. |
ServiceID
Description
A unique service identifier.
Socket
SocketID
Description
A content-addressed socket identifier.
String
Description
The String
scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.
TypeDef
Description
A definition of a parameter or return type in a Module.
Fields
Field Name | Description |
---|---|
id - TypeDefID! |
|
kind - TypeDefKind |
The kind of type this is (e.g. primitive, list, object) |
withKind - TypeDef! |
Sets the kind of the type. |
Arguments
|
|
optional - Boolean! |
Whether this type can be set to null. Defaults to false. |
withOptional - TypeDef! |
Sets whether this type can be set to null. |
Arguments
|
|
withListOf - TypeDef! |
Returns a TypeDef of kind List with the provided type for its elements. |
Arguments
|
|
asList - ListTypeDef |
If kind is LIST, the list-specific type definition. If kind is not LIST, this will be null. |
withObject - TypeDef! |
Returns a TypeDef of kind Object with the provided name. Note that an object's fields and functions may be omitted if the intent is only to refer to an object. This is how functions are able to return their own object, or any other circular reference. |
withField - TypeDef! |
Adds a static field for an Object TypeDef, failing if the type is not an object. |
Arguments
|
|
withFunction - TypeDef! |
Adds a function for an Object TypeDef, failing if the type is not an object. |
Arguments
|
|
withConstructor - TypeDef! |
Adds a function for constructing a new instance of an Object TypeDef, failing if the type is not an object. |
Arguments
|
|
asObject - ObjectTypeDef |
If kind is OBJECT, the object-specific type definition. If kind is not OBJECT, this will be null. |
TypeDefID
Description
A reference to a TypeDef.
TypeDefKind
Description
Distinguishes the different kinds of TypeDefs.
Values
Enum Value | Description |
---|---|
|
A string value |
|
An integer value |
|
A boolean value |
|
A list of values all having the same type. Always paired with a ListTypeDef. |
|
A named type defined in the GraphQL schema, with fields and functions. Always paired with an ObjectTypeDef. |
|
A special kind used to signify that no value is returned. This is used for functions that have no return value. The outer TypeDef specifying this Kind is always Optional, as the Void is never actually represented. |
Example
"StringKind"
Void
Description
The absense of a value.
A Null Void is used as a placeholder for resolvers that do not return anything.