ref

abstract fun <T : NodeCompositeOutput?> ref(id: GlobalID<T>): T(source)

Creates a lazy reference to a Node from its GlobalID.

Only the id field is accessible on the returned reference; reading any other field throws. Use it to build resolver responses for fields with Node types.

Example: ctx.ref(ctx.globalIDFor(Type.ofClass(Planet.class), planetId)).

Return

an unresolved reference GRT

Parameters

id

the Node's GlobalID

<T>

the Node GRT type


abstract fun <T : GraphQLObject?> ref(call: RootFieldCall<T>): T(source)

Creates a lazy reference to an object-valued query root field or a field reachable through @namespaceType fields.

The engine resolves the reference after the current resolver returns it directly or embeds it in another GRT. Fields cannot be read from the unresolved reference.

Example: ctx.ref(ProductFactory.create()).

Return

an unresolved reference GRT

Parameters

call

the generated root field call

<T>

the field's object output type