FakeResolver

interface FakeResolver

Provides fakes values for Data builders

Functions

Link copied to clipboard
abstract fun resolveLeaf(context: FakeResolverContext): Any

Resolves a leaf (scalar or enum) type. Note that because of list and not-nullable types, the type of context.mergedField is not always the leaf type. You can get the type of the leaf type with:

Link copied to clipboard
abstract fun resolveListSize(context: FakeResolverContext): Int

Resolves the size of a list. Note that lists might be nested. You can use context.path to get the current nesting depth

Link copied to clipboard
abstract fun resolveMaybeNull(context: FakeResolverContext): Boolean
Link copied to clipboard
abstract fun resolveTypename(context: FakeResolverContext): String
Link copied to clipboard
abstract fun stableIdForObject(obj: Map<String, Any?>, mergedField: CompiledField): String?

Use stableIdForObject to provide FakeResolverContext.id. You can then use FakeResolverContext.id to derive stable values in the resolveXyz() methods above. This way, you're guaranteed that a fake object will have the same field values no matter its path in the query.

Inheritors

Link copied to clipboard