# 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

DynamicOutputValueBuilder
Link copied to clipboard
interface DynamicOutputValueBuilder<T>

Builder interface for dynamic output values.

FieldValue
Link copied to clipboard
sealed interface FieldValue<out T>

Represents the value of a resolved GraphQL object field

Resolver
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.

TenantModule
Link copied to clipboard
interface TenantModule
ValueMapper
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.

Variable
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)
Variables
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class Variables(val types: String)
VariablesProvider
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.

ViaductFrameworkException
Link copied to clipboard
class ViaductFrameworkException : Exception

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

ViaductTenantException
Link copied to clipboard
interface ViaductTenantException

Marker interface for exceptions that should be attributed to tenant code

ViaductTenantResolverException
Link copied to clipboard
class ViaductTenantResolverException(val cause: Throwable, val resolver: String) : Exception, ViaductTenantException

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

ViaductTenantUsageException
Link copied to clipboard
class ViaductTenantUsageException(message: String, cause: Throwable? = null) : Exception, ViaductTenantException

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

## Functions

wrapResolveException
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.