ref

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

Creates a lazy reference given a Node ID. Only the ID field is accessible from the created reference. Attempting to access other fields will result in an exception. This can be used to construct resolver responses for fields with Node types.


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

Creates a lazy reference to a root field that will be later resolved by the engine.

No fields are accessible from the returned value. Attempting to access fields will result in an exception. The returned value may be used as a resolver return value or passed to a GRT builder.

Example usage:

val product = ctx.ref(ProductFactory.create { name("Air") })