As

zio.blocks.schema.As
See theAs companion object
trait As[A, B] extends Into[A, B]

Bidirectional conversion between types A and B.

As[A, B] extends Into[A, B], so it can be used anywhere an Into is expected. Use reverse to get an As[B, A] that reverses the direction.

For As[A, B] to be derivable, the bidirectional conversion must be compatible:

Compatibility Rules:

  • Field mappings must be consistent: The same field correspondence in both directions
  • Coercions must be invertible with runtime validation (Int ↔ Long, Float ↔ Double, etc.)
  • Optional fields: Can add optional fields in one direction (becomes None in reverse)
  • Default values: Allowed only on fields that exist in both types. Fields with defaults that don't exist in the other type break round-trip guarantee.
  • Collection types: Can convert between different collection types (may be lossy for Set/List conversions)

Attributes

Companion
object
Source
As.scala
Graph
Supertypes
trait Into[A, B]
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def from(input: B): Either[SchemaError, A]

Attributes

Source
As.scala
def into(a: A): Either[SchemaError, B]
Implicitly added by reverseInto

Attributes

Source
Into.scala

Concrete methods

def reverse: As[B, A]

Reverses the direction of this As, producing an As[B, A].

Reverses the direction of this As, producing an As[B, A].

Attributes

Source
As.scala

Inherited and Abstract methods

def into(a: A): Either[SchemaError, B]

Attributes

Inherited from:
Into
Source
Into.scala