BindingResolver

zio.blocks.schema.binding.BindingResolver
See theBindingResolver companion object

A binding resolver provides bindings for types during schema rebinding.

BindingResolver is the read-only interface for looking up bindings by type identity. Multiple resolvers can be combined using ++ to form resolution chains with fallback behavior.

The library provides several resolver implementations:

Attributes

Example
import zio.blocks.schema.binding._
case class Person(name: String, age: Int)
val customRegistry = BindingResolver.empty.bind(Binding.of[Person])
// Use defaults for primitives and collections, with custom bindings
val resolver = customRegistry ++ BindingResolver.defaults
// Add reflection-based derivation as fallback
val withReflection = customRegistry ++ BindingResolver.reflection ++ BindingResolver.defaults
Companion
object
Source
BindingResolver.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Registry
Self type

Members list

Value members

Abstract methods

def resolveDynamic(implicit typeId: TypeId[DynamicValue]): Option[Dynamic]

Resolves the dynamic binding.

Resolves the dynamic binding.

Value parameters

typeId

The TypeId for DynamicValue (usually derived implicitly)

Attributes

Returns

The binding if found, None otherwise

Source
BindingResolver.scala
def resolveMap[X](implicit typeId: TypeId[X], u: UnapplyMap[X]): Option[Map[u.M, u.K, u.V]]

Resolves a map binding for an applied map type.

Resolves a map binding for an applied map type.

Uses UnapplyMap to decompose the applied type and resolve the binding by type constructor.

Type parameters

X

The applied map type (e.g., Map[String, Int])

Value parameters

typeId

The TypeId for type X (usually derived implicitly)

u

Evidence that X is an applied map type

Attributes

Returns

The binding if found, None otherwise

Source
BindingResolver.scala
def resolveMapFor[M[_, _], K, V](typeId: TypeId[M[K, V]]): Option[Map[M, K, V]]

Resolves a map binding given an explicit TypeId for the applied type.

Resolves a map binding given an explicit TypeId for the applied type.

This variant is useful when you already have the map type constructor and key/value types as separate type parameters.

Type parameters

K

The key type

M

The map type constructor (e.g., Map)

V

The value type

Value parameters

typeId

The TypeId for the applied type M[K, V]

Attributes

Returns

The binding if found, None otherwise

Source
BindingResolver.scala
def resolvePrimitive[A](implicit typeId: TypeId[A]): Option[Primitive[A]]

Resolves a primitive binding for a type.

Resolves a primitive binding for a type.

Type parameters

A

The type to resolve

Value parameters

typeId

The TypeId for type A (usually derived implicitly)

Attributes

Returns

The binding if found, None otherwise

Source
BindingResolver.scala
def resolveRecord[A](implicit typeId: TypeId[A]): Option[Record[A]]

Resolves a record binding for a type.

Resolves a record binding for a type.

Type parameters

A

The type to resolve

Value parameters

typeId

The TypeId for type A (usually derived implicitly)

Attributes

Returns

The binding if found, None otherwise

Source
BindingResolver.scala
def resolveSeq[X](implicit typeId: TypeId[X], u: UnapplySeq[X]): Option[Seq[u.C, u.A]]

Resolves a sequence binding for an applied sequence type.

Resolves a sequence binding for an applied sequence type.

Uses UnapplySeq to decompose the applied type and resolve the binding by type constructor.

Type parameters

X

The applied sequence type (e.g., List[Int])

Value parameters

typeId

The TypeId for type X (usually derived implicitly)

u

Evidence that X is an applied sequence type

Attributes

Returns

The binding if found, None otherwise

Source
BindingResolver.scala
def resolveSeqFor[C[_], A](typeId: TypeId[C[A]]): Option[Seq[C, A]]

Resolves a sequence binding given an explicit TypeId for the applied type.

Resolves a sequence binding given an explicit TypeId for the applied type.

This variant is useful when you already have the type constructor and element type as separate type parameters.

Type parameters

A

The element type

C

The sequence type constructor (e.g., List)

Value parameters

typeId

The TypeId for the applied type C[A]

Attributes

Returns

The binding if found, None otherwise

Source
BindingResolver.scala
def resolveVariant[A](implicit typeId: TypeId[A]): Option[Variant[A]]

Resolves a variant binding for a type.

Resolves a variant binding for a type.

Type parameters

A

The type to resolve

Value parameters

typeId

The TypeId for type A (usually derived implicitly)

Attributes

Returns

The binding if found, None otherwise

Source
BindingResolver.scala
def resolveWrapper[A](implicit typeId: TypeId[A]): Option[Wrapper[A, _]]

Resolves a wrapper binding for a type.

Resolves a wrapper binding for a type.

Type parameters

A

The wrapper type

Value parameters

typeId

The TypeId for type A (usually derived implicitly)

Attributes

Returns

The binding if found, None otherwise

Source
BindingResolver.scala

Concrete methods

final def ++(that: BindingResolver): BindingResolver

Combines this resolver with another, trying this resolver first.

Combines this resolver with another, trying this resolver first.

When resolving a binding, the combined resolver tries this first. If this returns None, it falls back to that.

Value parameters

that

The fallback resolver

Attributes

Returns

A combined resolver that tries this first, then that

Example
import zio.blocks.schema.binding._
case class Person(name: String, age: Int)
val customRegistry = BindingResolver.empty.bind(Binding.of[Person])
// customRegistry overrides defaults
val resolver = customRegistry ++ BindingResolver.defaults
Source
BindingResolver.scala