Package-level declarations

This is the main package for the Viaduct Tenant API, containing the core interfaces and classes that tenants will use to implement their GraphQL schema behavior.

Types

Link copied to clipboard

Builder interface for dynamic output values.

Link copied to clipboard
sealed interface FieldValue<out T>

Represents the value of a resolved GraphQL object field

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class Resolver(val objectValueFragment: String = "", val queryValueFragment: String = "", val variables: Array<Variable> = [])

Annotation to mark a class as a resolver for a field or object in a GraphQL schema which requires custom resolution logic rather than simple property access.

Link copied to clipboard
interface TenantModule
Link copied to clipboard
interface ValueMapper<D : Any>

Provides a custom implementation for mapping a data type to a Viaduct object type. Implementations should be registered using the service loader mechanism.

Link copied to clipboard
annotation class Variable(val name: String, val fromObjectField: String = UNSET_STRING_VALUE, val fromQueryField: String = UNSET_STRING_VALUE, val fromArgument: String = UNSET_STRING_VALUE)
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class Variables(val types: String)
Link copied to clipboard
fun interface VariablesProvider<T : Arguments>

A base interface for dynamic provisioning of variable values. All implementations of VariablesProvider must be annotated with Variables.

Link copied to clipboard

Used in the tenant API and dependencies to indicate that an error is due to framework code and shouldn't be attributed to tenant code

Link copied to clipboard

Marker interface for exceptions that should be attributed to tenant code

Link copied to clipboard

Used to wrap non-framework exceptions that are thrown while executing tenant resolver code. This is tied to a specific tenant-written resolver.

Link copied to clipboard

Used in framework code to indicate that an error is due to invalid usage of the tenant API by tenant code.

Functions

Link copied to clipboard
suspend fun wrapResolveException(resolverId: String, resolveFn: suspend () -> Any?): Any?

Catches any exception thrown by resolveFn (which must be called via reflection) and wraps it in ViaductTenantResolverException unless it's a ViaductFrameworkException.