Variables Provider
A base interface for dynamic provisioning of variable values. All implementations of VariablesProvider must be annotated with Variables.
If a viaduct resolver declares a VariablesProvider, it will be invoked at request time to provide additional variable values that may be used in an Resolver.objectValueFragment.
Example:
@Resolver("baz(${'$'}x)")
class FooBarResolver : FooResolvers.Bar() {
@Variables("x: Int")
class Vars : VariablesProvider<Arguments.NoArguments> {
override suspend fun provide(args: Arguments.NoArguments): Map<String, Any?> =
mapOf("x" to 42)
}
}Content copied to clipboard