Skip to main content

Module

API reference​

A Dagger module.

Implements Node, Syncer

description
The doc string of the module, if any
id
A unique identifier for this Module.
name
The name of the module
serve
Serve a module's API in the current session.
contextSource
The source used to resolve contextual files and directories, when different from source.
dependencies
The dependencies of the module.
enums
Enumerations served by this module.
generatedContextDirectory
The generated files and directories made on top of the module source's context directory.
interfaces
Interfaces served by this module.
introspectionSchemaJSON
The introspection schema JSON file for this module.
objects
Objects served by this module.
runtime
The container that runs the module's entrypoint. It will fail to execute if the module doesn't compile.
sdk
The SDK config used by this module.
source
The source for the module.
sync
Forces evaluation of the module, including any loading into the engine and associated validation.
userDefaults
User-defined default values, loaded from local .env files.
withDescription
Retrieves the module with the given description
withEnum
This module plus the given Enum type and associated values
withInterface
This module plus the given Interface type and associated functions
withObject
This module plus the given Object type and associated functions.

description: String!

The doc string of the module, if any

id: ID!

A unique identifier for this Module.

name: String!

The name of the module

serve(includeDependencies: Boolean, entrypoint: Boolean): 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.

includeDependencies: Boolean

Expose the dependencies of this module to the client

entrypoint: Boolean

Install the module as the entrypoint, promoting its main-object methods onto the Query root

contextSource: ModuleSource

The source used to resolve contextual files and directories, when different from source.

dependencies: [Module!]!

The dependencies of the module.

enums: [TypeDef!]!

Enumerations served by this module.

generatedContextDirectory: Directory!

The generated files and directories made on top of the module source's context directory.

interfaces: [TypeDef!]!

Interfaces served by this module.

introspectionSchemaJSON: File!

The introspection schema JSON file for this module.

This file represents the schema visible to the module's source code, including all core types and those from the dependencies.

Note: this is in the context of a module, so some core types may be hidden.

objects: [TypeDef!]!

Objects served by this module.

runtime: Container

The container that runs the module's entrypoint. It will fail to execute if the module doesn't compile.

sdk: SDKConfig

The SDK config used by this module.

source: ModuleSource

The source for the module.

sync: Module!

Forces evaluation of the module, including any loading into the engine and associated validation.

userDefaults: EnvFile!

User-defined default values, loaded from local .env files.

withDescription(description: String!): Module!

Retrieves the module with the given description

description: String!

The description to set

withEnum(enum: TypeDef!): Module!

This module plus the given Enum type and associated values

enum: TypeDef!

withInterface(iface: TypeDef!): Module!

This module plus the given Interface type and associated functions

iface: TypeDef!

withObject(object: TypeDef!): Module!

This module plus the given Object type and associated functions.

object: TypeDef!

References

Returned by