Fallback

zio.schema.Schema.Fallback
final case class Fallback[A, B](left: Schema[A], right: Schema[B], fullDecode: Boolean = ..., annotations: Chunk[Any] = ...) extends Schema[Fallback[A, B]]

Schema for zio.schema.Fallback type. If fullDecode is set to true, it will decode Fallback.Both from Fallback.Both. If set to false, it will decode Fallback.Left when possible and Fallback.Right as second option from a Fallback.Both.

Attributes

Source
Schema.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Schema[Fallback[A, B]]
class Object
trait Matchable
class Any
Show all
Self type
Fallback[A, B]

Members list

Type members

Types

override type Accessors[Lens[_, _, _], Prism[_, _, _], Traversal[_, _]] = (Prism[rightSingleton.type, Either[A, B], Right[Nothing, B]], Prism[leftSingleton.type, Either[A, B], Left[A, Nothing]])

Attributes

Source
Schema.scala
type LeftType = A

Attributes

Source
Schema.scala
type RightType = B

Attributes

Source
Schema.scala

Value members

Concrete methods

override def annotate(annotation: Any): Fallback[A, B]

Returns a new schema that with annotation

Returns a new schema that with annotation

Attributes

Definition Classes
Source
Schema.scala
override def defaultValue: Either[String, Fallback[A, B]]

The default value for a Schema of type A.

The default value for a Schema of type A.

Attributes

Definition Classes
Source
Schema.scala
override def makeAccessors(b: AccessorBuilder): (b.Prism[rightSingleton.type, Either[A, B], Right[Nothing, B]], b.Prism[leftSingleton.type, Either[A, B], Left[A, Nothing]])

Attributes

Definition Classes
Source
Schema.scala
transparent inline def merge: Schema[C]
Extension method from zio.schema

Attributes

Source
package.scala

Inherited methods

def <*>[B](that: Schema[B]): Schema[(Fallback[A, B], B)]

A symbolic operator for zip.

A symbolic operator for zip.

Attributes

Inherited from:
Schema
Source
Schema.scala
def <+>[B](that: Schema[B]): Schema[Either[Fallback[A, B], B]]

A symbolic operator for orElseEither.

A symbolic operator for orElseEither.

Attributes

Inherited from:
Schema
Source
Schema.scala
def ?: Schema[Option[Fallback[A, B]]]

A symbolic operator for optional.

A symbolic operator for optional.

Attributes

Inherited from:
Schema
Source
Schema.scala

Attributes

Inherited from:
Schema
Source
Schema.scala
def coerce[B](newSchema: Schema[B]): Either[String, Schema[B]]

Convert to Schema[B] iff B and A are homomorphic.

Convert to Schema[B] iff B and A are homomorphic.

This can be used to e.g convert between a case class and it's "generic" representation as a ListMap[String,_]

Attributes

Inherited from:
Schema
Source
Schema.scala
def default(value: Fallback[A, B]): Schema[Fallback[A, B]]

Add a default value to this schema.

Add a default value to this schema.

Attributes

Inherited from:
Schema
Source
Schema.scala
def diff(thisValue: Fallback[A, B], thatValue: Fallback[A, B]): Patch[Fallback[A, B]]

Performs a diff between thisValue and thatValue. See zio.schema.Differ for details on the default diff algorithms.

Performs a diff between thisValue and thatValue. See zio.schema.Differ for details on the default diff algorithms.

Attributes

Inherited from:
Schema
Source
Schema.scala

Attributes

Inherited from:
Schema
Source
Schema.scala
def migrate[B](newSchema: Schema[B]): Either[String, Fallback[A, B] => Either[String, B]]

Generate a homomorphism from A to B iff A and B are homomorphic

Generate a homomorphism from A to B iff A and B are homomorphic

Attributes

Inherited from:
Schema
Source
Schema.scala

Returns a new schema that modifies the type produced by this schema to be optional.

Returns a new schema that modifies the type produced by this schema to be optional.

Attributes

Inherited from:
Schema
Source
Schema.scala
def orElseEither[B](that: Schema[B]): Schema[Either[Fallback[A, B], B]]

Returns a new schema that combines this schema and the specified schema together, modeling their either composition.

Returns a new schema that combines this schema and the specified schema together, modeling their either composition.

Attributes

Inherited from:
Schema
Source
Schema.scala
def ordering: Ordering[Fallback[A, B]]

Attributes

Inherited from:
Schema
Source
Schema.scala
def patch(oldValue: Fallback[A, B], diff: Patch[Fallback[A, B]]): Either[String, Fallback[A, B]]

Patch value with a Patch.

Patch value with a Patch.

Attributes

Inherited from:
Schema
Source
Schema.scala

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala
def repeated: Schema[Chunk[Fallback[A, B]]]

Attributes

Inherited from:
Schema
Source
Schema.scala

Attributes

Inherited from:
Schema
Source
Schema.scala
def toDynamic(value: Fallback[A, B]): DynamicValue

Attributes

Inherited from:
Schema
Source
Schema.scala
def transform[B](f: Fallback[A, B] => B, g: B => Fallback[A, B])(implicit loc: SourceLocation): Schema[B]

Transforms this Schema[A] into a Schema[B], by supplying two functions that can transform between A and B, without possibility of failure.

Transforms this Schema[A] into a Schema[B], by supplying two functions that can transform between A and B, without possibility of failure.

Attributes

Inherited from:
Schema
Source
Schema.scala
def transformOrFail[B](f: Fallback[A, B] => Either[String, B], g: B => Either[String, Fallback[A, B]])(implicit loc: SourceLocation): Schema[B]

Transforms this Schema[A] into a Schema[B], by supplying two functions that can transform between A and B (possibly failing in some cases).

Transforms this Schema[A] into a Schema[B], by supplying two functions that can transform between A and B (possibly failing in some cases).

Attributes

Inherited from:
Schema
Source
Schema.scala
def validate(value: Fallback[A, B])(implicit schema: Schema[Fallback[A, B]]): Chunk[ValidationError]

Attributes

Inherited from:
Schema
Source
Schema.scala
def validation(validation: Validation[Fallback[A, B]]): Schema[Fallback[A, B]]

Attributes

Inherited from:
Schema
Source
Schema.scala
def zip[B](that: Schema[B]): Schema[(Fallback[A, B], B)]

Returns a new schema that combines this schema and the specified schema together, modeling their tuple composition.

Returns a new schema that combines this schema and the specified schema together, modeling their tuple composition.

Attributes

Inherited from:
Schema
Source
Schema.scala

Concrete fields

val leftSchema: Schema[Left[A, Nothing]]

Attributes

Source
Schema.scala
val leftSingleton: String

Attributes

Source
Schema.scala
val rightSchema: Schema[Right[Nothing, B]]

Attributes

Source
Schema.scala
val rightSingleton: String

Attributes

Source
Schema.scala
val toEither: Either[A, B]

Attributes

Source
Schema.scala
val toEnum: Enum2[Right[Nothing, B], Left[A, Nothing], Either[A, B]]

Attributes

Source
Schema.scala