Schema

zio.blocks.schema.Schema
See theSchema companion object
final case class Schema[A](reflect: Bound[A]) extends SchemaVersionSpecific[A]

A Schema[A] describes the structure of the type A, such as the fields of a case class or the cases of a sealed trait, together with the functions that build and take apart values of A. Derive one with Schema.derived, then use it to get codecs for formats such as JSON, convert values to and from DynamicValue, compute and apply patches, and attach documentation, examples and default values.

A schema is an immutable value: methods such as doc, defaultValue and modifier return a new schema. It wraps a Reflect.Bound[A], which holds the structure and its bindings.

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val json = Schema[Book].jsonCodec.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","year":2021}
val value = Schema[Book].toDynamicValue(Book("Zionomicon", 2021))
// {
//   title: "Zionomicon",
//   year: 2021
// }

Attributes

See also
Companion
object
Source
Schema.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def @@[Min >: A, Max <: A](aspect: SchemaAspect[Min, Max, Binding]): Schema[A]
Implicitly added by chunk

Returns a schema with aspect applied to the whole structure of A.

Returns a schema with aspect applied to the whole structure of A.

Attributes

Source
Schema.scala
def @@[B](part: Optic[A, B], aspect: SchemaAspect[B, B, Binding]): Schema[A]
Implicitly added by chunk

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def @@[Min >: A, Max <: A](aspect: SchemaAspect[Min, Max, Binding]): Schema[A]
Implicitly added by indexedSeq

Returns a schema with aspect applied to the whole structure of A.

Returns a schema with aspect applied to the whole structure of A.

Attributes

Source
Schema.scala
def @@[B](part: Optic[A, B], aspect: SchemaAspect[B, B, Binding]): Schema[A]
Implicitly added by indexedSeq

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def @@[Min >: A, Max <: A](aspect: SchemaAspect[Min, Max, Binding]): Schema[A]
Implicitly added by list

Returns a schema with aspect applied to the whole structure of A.

Returns a schema with aspect applied to the whole structure of A.

Attributes

Source
Schema.scala
def @@[B](part: Optic[A, B], aspect: SchemaAspect[B, B, Binding]): Schema[A]
Implicitly added by list

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def @@[Min >: A, Max <: A](aspect: SchemaAspect[Min, Max, Binding]): Schema[A]
Implicitly added by maybe

Returns a schema with aspect applied to the whole structure of A.

Returns a schema with aspect applied to the whole structure of A.

Attributes

Source
Schema.scala
def @@[B](part: Optic[A, B], aspect: SchemaAspect[B, B, Binding]): Schema[A]
Implicitly added by maybe

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def @@[Min >: A, Max <: A](aspect: SchemaAspect[Min, Max, Binding]): Schema[A]
Implicitly added by option

Returns a schema with aspect applied to the whole structure of A.

Returns a schema with aspect applied to the whole structure of A.

Attributes

Source
Schema.scala
def @@[B](part: Optic[A, B], aspect: SchemaAspect[B, B, Binding]): Schema[A]
Implicitly added by option

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def @@[Min >: A, Max <: A](aspect: SchemaAspect[Min, Max, Binding]): Schema[A]
Implicitly added by seq

Returns a schema with aspect applied to the whole structure of A.

Returns a schema with aspect applied to the whole structure of A.

Attributes

Source
Schema.scala
def @@[B](part: Optic[A, B], aspect: SchemaAspect[B, B, Binding]): Schema[A]
Implicitly added by seq

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def @@[Min >: A, Max <: A](aspect: SchemaAspect[Min, Max, Binding]): Schema[A]
Implicitly added by set

Returns a schema with aspect applied to the whole structure of A.

Returns a schema with aspect applied to the whole structure of A.

Attributes

Source
Schema.scala
def @@[B](part: Optic[A, B], aspect: SchemaAspect[B, B, Binding]): Schema[A]
Implicitly added by set

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def @@[Min >: A, Max <: A](aspect: SchemaAspect[Min, Max, Binding]): Schema[A]
Implicitly added by vector

Returns a schema with aspect applied to the whole structure of A.

Returns a schema with aspect applied to the whole structure of A.

Attributes

Source
Schema.scala
def @@[B](part: Optic[A, B], aspect: SchemaAspect[B, B, Binding]): Schema[A]
Implicitly added by vector

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def @@[Min >: A, Max <: A](aspect: SchemaAspect[Min, Max, Binding]): Schema[A]

Returns a schema with aspect applied to the whole structure of A.

Returns a schema with aspect applied to the whole structure of A.

Attributes

Source
Schema.scala
def @@[B](part: Optic[A, B], aspect: SchemaAspect[B, B, Binding]): Schema[A]

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema with aspect applied to the part of A that part focuses on. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def decode[F <: Format](format: F)(decodeInput: format.DecodeInput): Either[SchemaError, A]
Implicitly added by chunk

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val input = ByteBuffer.wrap("""{"title":"Zionomicon","year":2021}""".getBytes(StandardCharsets.UTF_8))
val book  = Book.schema.decode(JsonFormat)(input) // Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala
def decode[F <: Format](format: F)(decodeInput: format.DecodeInput): Either[SchemaError, A]
Implicitly added by indexedSeq

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val input = ByteBuffer.wrap("""{"title":"Zionomicon","year":2021}""".getBytes(StandardCharsets.UTF_8))
val book  = Book.schema.decode(JsonFormat)(input) // Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala
def decode[F <: Format](format: F)(decodeInput: format.DecodeInput): Either[SchemaError, A]
Implicitly added by list

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val input = ByteBuffer.wrap("""{"title":"Zionomicon","year":2021}""".getBytes(StandardCharsets.UTF_8))
val book  = Book.schema.decode(JsonFormat)(input) // Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala
def decode[F <: Format](format: F)(decodeInput: format.DecodeInput): Either[SchemaError, A]
Implicitly added by maybe

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val input = ByteBuffer.wrap("""{"title":"Zionomicon","year":2021}""".getBytes(StandardCharsets.UTF_8))
val book  = Book.schema.decode(JsonFormat)(input) // Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala
def decode[F <: Format](format: F)(decodeInput: format.DecodeInput): Either[SchemaError, A]
Implicitly added by option

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val input = ByteBuffer.wrap("""{"title":"Zionomicon","year":2021}""".getBytes(StandardCharsets.UTF_8))
val book  = Book.schema.decode(JsonFormat)(input) // Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala
def decode[F <: Format](format: F)(decodeInput: format.DecodeInput): Either[SchemaError, A]
Implicitly added by seq

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val input = ByteBuffer.wrap("""{"title":"Zionomicon","year":2021}""".getBytes(StandardCharsets.UTF_8))
val book  = Book.schema.decode(JsonFormat)(input) // Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala
def decode[F <: Format](format: F)(decodeInput: format.DecodeInput): Either[SchemaError, A]
Implicitly added by set

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val input = ByteBuffer.wrap("""{"title":"Zionomicon","year":2021}""".getBytes(StandardCharsets.UTF_8))
val book  = Book.schema.decode(JsonFormat)(input) // Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala
def decode[F <: Format](format: F)(decodeInput: format.DecodeInput): Either[SchemaError, A]
Implicitly added by vector

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val input = ByteBuffer.wrap("""{"title":"Zionomicon","year":2021}""".getBytes(StandardCharsets.UTF_8))
val book  = Book.schema.decode(JsonFormat)(input) // Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala
def decode[F <: Format](format: F)(decodeInput: format.DecodeInput): Either[SchemaError, A]

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

Decodes a value of A from decodeInput with the codec of format, the one getInstance returns, and returns Left when the input does not decode.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val input = ByteBuffer.wrap("""{"title":"Zionomicon","year":2021}""".getBytes(StandardCharsets.UTF_8))
val book  = Book.schema.decode(JsonFormat)(input) // Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala
def defaultValue[B](optic: Optic[A, B], value: => B): Schema[A]
Implicitly added by chunk

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

case class Book(title: String, year: Int = 2021)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val year: Lens[Book, Int]         = $(_.year)
}

val declared = Book.schema.getDefaultValue(Book.year)                              // Some(2021)
val updated  = Book.schema.defaultValue(Book.year, 2024).getDefaultValue(Book.year) // Some(2024)

Attributes

See also
Source
Schema.scala
def defaultValue(value: => A): Schema[A]
Implicitly added by chunk

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Attributes

Source
Schema.scala
def defaultValue[B](optic: Optic[A, B], value: => B): Schema[A]
Implicitly added by indexedSeq

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

case class Book(title: String, year: Int = 2021)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val year: Lens[Book, Int]         = $(_.year)
}

val declared = Book.schema.getDefaultValue(Book.year)                              // Some(2021)
val updated  = Book.schema.defaultValue(Book.year, 2024).getDefaultValue(Book.year) // Some(2024)

Attributes

See also
Source
Schema.scala
def defaultValue(value: => A): Schema[A]
Implicitly added by indexedSeq

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Attributes

Source
Schema.scala
def defaultValue[B](optic: Optic[A, B], value: => B): Schema[A]
Implicitly added by list

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

case class Book(title: String, year: Int = 2021)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val year: Lens[Book, Int]         = $(_.year)
}

val declared = Book.schema.getDefaultValue(Book.year)                              // Some(2021)
val updated  = Book.schema.defaultValue(Book.year, 2024).getDefaultValue(Book.year) // Some(2024)

Attributes

See also
Source
Schema.scala
def defaultValue(value: => A): Schema[A]
Implicitly added by list

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Attributes

Source
Schema.scala
def defaultValue[B](optic: Optic[A, B], value: => B): Schema[A]
Implicitly added by maybe

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

case class Book(title: String, year: Int = 2021)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val year: Lens[Book, Int]         = $(_.year)
}

val declared = Book.schema.getDefaultValue(Book.year)                              // Some(2021)
val updated  = Book.schema.defaultValue(Book.year, 2024).getDefaultValue(Book.year) // Some(2024)

Attributes

See also
Source
Schema.scala
def defaultValue(value: => A): Schema[A]
Implicitly added by maybe

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Attributes

Source
Schema.scala
def defaultValue[B](optic: Optic[A, B], value: => B): Schema[A]
Implicitly added by option

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

case class Book(title: String, year: Int = 2021)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val year: Lens[Book, Int]         = $(_.year)
}

val declared = Book.schema.getDefaultValue(Book.year)                              // Some(2021)
val updated  = Book.schema.defaultValue(Book.year, 2024).getDefaultValue(Book.year) // Some(2024)

Attributes

See also
Source
Schema.scala
def defaultValue(value: => A): Schema[A]
Implicitly added by option

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Attributes

Source
Schema.scala
def defaultValue[B](optic: Optic[A, B], value: => B): Schema[A]
Implicitly added by seq

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

case class Book(title: String, year: Int = 2021)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val year: Lens[Book, Int]         = $(_.year)
}

val declared = Book.schema.getDefaultValue(Book.year)                              // Some(2021)
val updated  = Book.schema.defaultValue(Book.year, 2024).getDefaultValue(Book.year) // Some(2024)

Attributes

See also
Source
Schema.scala
def defaultValue(value: => A): Schema[A]
Implicitly added by seq

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Attributes

Source
Schema.scala
def defaultValue[B](optic: Optic[A, B], value: => B): Schema[A]
Implicitly added by set

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

case class Book(title: String, year: Int = 2021)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val year: Lens[Book, Int]         = $(_.year)
}

val declared = Book.schema.getDefaultValue(Book.year)                              // Some(2021)
val updated  = Book.schema.defaultValue(Book.year, 2024).getDefaultValue(Book.year) // Some(2024)

Attributes

See also
Source
Schema.scala
def defaultValue(value: => A): Schema[A]
Implicitly added by set

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Attributes

Source
Schema.scala
def defaultValue[B](optic: Optic[A, B], value: => B): Schema[A]
Implicitly added by vector

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

case class Book(title: String, year: Int = 2021)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val year: Lens[Book, Int]         = $(_.year)
}

val declared = Book.schema.getDefaultValue(Book.year)                              // Some(2021)
val updated  = Book.schema.defaultValue(Book.year, 2024).getDefaultValue(Book.year) // Some(2024)

Attributes

See also
Source
Schema.scala
def defaultValue(value: => A): Schema[A]
Implicitly added by vector

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Attributes

Source
Schema.scala
def defaultValue[B](optic: Optic[A, B], value: => B): Schema[A]

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the default value value. When the optic does not resolve against this schema, this schema is returned unchanged.

case class Book(title: String, year: Int = 2021)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val year: Lens[Book, Int]         = $(_.year)
}

val declared = Book.schema.getDefaultValue(Book.year)                              // Some(2021)
val updated  = Book.schema.defaultValue(Book.year, 2024).getDefaultValue(Book.year) // Some(2024)

Attributes

See also
Source
Schema.scala
def defaultValue(value: => A): Schema[A]

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Returns a schema whose default value for A is value, the value that getDefaultValue then returns.

Attributes

Source
Schema.scala
def derive[D, TC[_]](d: D)(implicit ev: Derivable[D, TC]): TC[A]
Implicitly added by chunk

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

import zio.blocks.schema.json.{JsonCodec, JsonCodecDeriver, JsonFormat}

case class Book(title: String, publishedIn: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val default: JsonCodec[Book]   = Book.schema.derive(JsonFormat)
val snakeCase: JsonCodec[Book] = Book.schema.derive(JsonCodecDeriver.withFieldNameMapper(NameMapper.SnakeCase))

val json = snakeCase.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","published_in":2021}

Attributes

See also
Source
Schema.scala
def derive[D, TC[_]](d: D)(implicit ev: Derivable[D, TC]): TC[A]
Implicitly added by indexedSeq

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

import zio.blocks.schema.json.{JsonCodec, JsonCodecDeriver, JsonFormat}

case class Book(title: String, publishedIn: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val default: JsonCodec[Book]   = Book.schema.derive(JsonFormat)
val snakeCase: JsonCodec[Book] = Book.schema.derive(JsonCodecDeriver.withFieldNameMapper(NameMapper.SnakeCase))

val json = snakeCase.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","published_in":2021}

Attributes

See also
Source
Schema.scala
def derive[D, TC[_]](d: D)(implicit ev: Derivable[D, TC]): TC[A]
Implicitly added by list

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

import zio.blocks.schema.json.{JsonCodec, JsonCodecDeriver, JsonFormat}

case class Book(title: String, publishedIn: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val default: JsonCodec[Book]   = Book.schema.derive(JsonFormat)
val snakeCase: JsonCodec[Book] = Book.schema.derive(JsonCodecDeriver.withFieldNameMapper(NameMapper.SnakeCase))

val json = snakeCase.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","published_in":2021}

Attributes

See also
Source
Schema.scala
def derive[D, TC[_]](d: D)(implicit ev: Derivable[D, TC]): TC[A]
Implicitly added by maybe

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

import zio.blocks.schema.json.{JsonCodec, JsonCodecDeriver, JsonFormat}

case class Book(title: String, publishedIn: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val default: JsonCodec[Book]   = Book.schema.derive(JsonFormat)
val snakeCase: JsonCodec[Book] = Book.schema.derive(JsonCodecDeriver.withFieldNameMapper(NameMapper.SnakeCase))

val json = snakeCase.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","published_in":2021}

Attributes

See also
Source
Schema.scala
def derive[D, TC[_]](d: D)(implicit ev: Derivable[D, TC]): TC[A]
Implicitly added by option

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

import zio.blocks.schema.json.{JsonCodec, JsonCodecDeriver, JsonFormat}

case class Book(title: String, publishedIn: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val default: JsonCodec[Book]   = Book.schema.derive(JsonFormat)
val snakeCase: JsonCodec[Book] = Book.schema.derive(JsonCodecDeriver.withFieldNameMapper(NameMapper.SnakeCase))

val json = snakeCase.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","published_in":2021}

Attributes

See also
Source
Schema.scala
def derive[D, TC[_]](d: D)(implicit ev: Derivable[D, TC]): TC[A]
Implicitly added by seq

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

import zio.blocks.schema.json.{JsonCodec, JsonCodecDeriver, JsonFormat}

case class Book(title: String, publishedIn: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val default: JsonCodec[Book]   = Book.schema.derive(JsonFormat)
val snakeCase: JsonCodec[Book] = Book.schema.derive(JsonCodecDeriver.withFieldNameMapper(NameMapper.SnakeCase))

val json = snakeCase.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","published_in":2021}

Attributes

See also
Source
Schema.scala
def derive[D, TC[_]](d: D)(implicit ev: Derivable[D, TC]): TC[A]
Implicitly added by set

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

import zio.blocks.schema.json.{JsonCodec, JsonCodecDeriver, JsonFormat}

case class Book(title: String, publishedIn: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val default: JsonCodec[Book]   = Book.schema.derive(JsonFormat)
val snakeCase: JsonCodec[Book] = Book.schema.derive(JsonCodecDeriver.withFieldNameMapper(NameMapper.SnakeCase))

val json = snakeCase.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","published_in":2021}

Attributes

See also
Source
Schema.scala
def derive[D, TC[_]](d: D)(implicit ev: Derivable[D, TC]): TC[A]
Implicitly added by vector

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

import zio.blocks.schema.json.{JsonCodec, JsonCodecDeriver, JsonFormat}

case class Book(title: String, publishedIn: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val default: JsonCodec[Book]   = Book.schema.derive(JsonFormat)
val snakeCase: JsonCodec[Book] = Book.schema.derive(JsonCodecDeriver.withFieldNameMapper(NameMapper.SnakeCase))

val json = snakeCase.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","published_in":2021}

Attributes

See also
Source
Schema.scala
def derive[D, TC[_]](d: D)(implicit ev: Derivable[D, TC]): TC[A]

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

Derives an instance of the type class TC for A with d: a Deriver[TC], or a format such as JsonFormat, whose default deriver is then used. Unlike getInstance, each call derives a new instance, so keep the result, for example in an implicit val.

import zio.blocks.schema.json.{JsonCodec, JsonCodecDeriver, JsonFormat}

case class Book(title: String, publishedIn: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val default: JsonCodec[Book]   = Book.schema.derive(JsonFormat)
val snakeCase: JsonCodec[Book] = Book.schema.derive(JsonCodecDeriver.withFieldNameMapper(NameMapper.SnakeCase))

val json = snakeCase.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","published_in":2021}

Attributes

See also
Source
Schema.scala
def deriving[TC[_]](deriver: Deriver[TC]): DerivationBuilder[TC, A]
Implicitly added by chunk

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

When deriver already has a withInstance override for a type, that override wins over one given for the same type with DerivationBuilder#instance.

import zio.blocks.schema.json.JsonCodecDeriver

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val codec = Book.schema
 .deriving(JsonCodecDeriver)
 .modifier(Book.title, Modifier.rename("name"))
 .derive

val json = codec.encodeToString(Book("Zionomicon", 2021)) // {"name":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def deriving[TC[_]](deriver: Deriver[TC]): DerivationBuilder[TC, A]
Implicitly added by indexedSeq

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

When deriver already has a withInstance override for a type, that override wins over one given for the same type with DerivationBuilder#instance.

import zio.blocks.schema.json.JsonCodecDeriver

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val codec = Book.schema
 .deriving(JsonCodecDeriver)
 .modifier(Book.title, Modifier.rename("name"))
 .derive

val json = codec.encodeToString(Book("Zionomicon", 2021)) // {"name":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def deriving[TC[_]](deriver: Deriver[TC]): DerivationBuilder[TC, A]
Implicitly added by list

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

When deriver already has a withInstance override for a type, that override wins over one given for the same type with DerivationBuilder#instance.

import zio.blocks.schema.json.JsonCodecDeriver

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val codec = Book.schema
 .deriving(JsonCodecDeriver)
 .modifier(Book.title, Modifier.rename("name"))
 .derive

val json = codec.encodeToString(Book("Zionomicon", 2021)) // {"name":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def deriving[TC[_]](deriver: Deriver[TC]): DerivationBuilder[TC, A]
Implicitly added by maybe

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

When deriver already has a withInstance override for a type, that override wins over one given for the same type with DerivationBuilder#instance.

import zio.blocks.schema.json.JsonCodecDeriver

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val codec = Book.schema
 .deriving(JsonCodecDeriver)
 .modifier(Book.title, Modifier.rename("name"))
 .derive

val json = codec.encodeToString(Book("Zionomicon", 2021)) // {"name":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def deriving[TC[_]](deriver: Deriver[TC]): DerivationBuilder[TC, A]
Implicitly added by option

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

When deriver already has a withInstance override for a type, that override wins over one given for the same type with DerivationBuilder#instance.

import zio.blocks.schema.json.JsonCodecDeriver

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val codec = Book.schema
 .deriving(JsonCodecDeriver)
 .modifier(Book.title, Modifier.rename("name"))
 .derive

val json = codec.encodeToString(Book("Zionomicon", 2021)) // {"name":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def deriving[TC[_]](deriver: Deriver[TC]): DerivationBuilder[TC, A]
Implicitly added by seq

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

When deriver already has a withInstance override for a type, that override wins over one given for the same type with DerivationBuilder#instance.

import zio.blocks.schema.json.JsonCodecDeriver

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val codec = Book.schema
 .deriving(JsonCodecDeriver)
 .modifier(Book.title, Modifier.rename("name"))
 .derive

val json = codec.encodeToString(Book("Zionomicon", 2021)) // {"name":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def deriving[TC[_]](deriver: Deriver[TC]): DerivationBuilder[TC, A]
Implicitly added by set

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

When deriver already has a withInstance override for a type, that override wins over one given for the same type with DerivationBuilder#instance.

import zio.blocks.schema.json.JsonCodecDeriver

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val codec = Book.schema
 .deriving(JsonCodecDeriver)
 .modifier(Book.title, Modifier.rename("name"))
 .derive

val json = codec.encodeToString(Book("Zionomicon", 2021)) // {"name":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def deriving[TC[_]](deriver: Deriver[TC]): DerivationBuilder[TC, A]
Implicitly added by vector

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

When deriver already has a withInstance override for a type, that override wins over one given for the same type with DerivationBuilder#instance.

import zio.blocks.schema.json.JsonCodecDeriver

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val codec = Book.schema
 .deriving(JsonCodecDeriver)
 .modifier(Book.title, Modifier.rename("name"))
 .derive

val json = codec.encodeToString(Book("Zionomicon", 2021)) // {"name":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def deriving[TC[_]](deriver: Deriver[TC]): DerivationBuilder[TC, A]

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

Starts a derivation of TC for A with deriver, which you can customize before calling derive on the result: override the instance used for a field, a case or a type, or add modifiers, without changing this schema. The result is not cached.

When deriver already has a withInstance override for a type, that override wins over one given for the same type with DerivationBuilder#instance.

import zio.blocks.schema.json.JsonCodecDeriver

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val codec = Book.schema
 .deriving(JsonCodecDeriver)
 .modifier(Book.title, Modifier.rename("name"))
 .derive

val json = codec.encodeToString(Book("Zionomicon", 2021)) // {"name":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def diff(oldValue: A, newValue: A): Patch[A]
Implicitly added by chunk

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Attributes

Source
Schema.scala
def diff(oldValue: A, newValue: A): Patch[A]
Implicitly added by indexedSeq

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Attributes

Source
Schema.scala
def diff(oldValue: A, newValue: A): Patch[A]
Implicitly added by list

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Attributes

Source
Schema.scala
def diff(oldValue: A, newValue: A): Patch[A]
Implicitly added by maybe

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Attributes

Source
Schema.scala
def diff(oldValue: A, newValue: A): Patch[A]
Implicitly added by option

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Attributes

Source
Schema.scala
def diff(oldValue: A, newValue: A): Patch[A]
Implicitly added by seq

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Attributes

Source
Schema.scala
def diff(oldValue: A, newValue: A): Patch[A]
Implicitly added by set

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Attributes

Source
Schema.scala
def diff(oldValue: A, newValue: A): Patch[A]
Implicitly added by vector

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Attributes

Source
Schema.scala
def diff(oldValue: A, newValue: A): Patch[A]

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Computes a patch that turns oldValue into newValue, by comparing the DynamicValue forms of the two values.

Attributes

Source
Schema.scala
def doc: Doc
Implicitly added by chunk

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Attributes

Source
Schema.scala
def doc(value: String): Schema[A]
Implicitly added by chunk

Returns a schema whose documentation is value, replacing any documentation it had.

Returns a schema whose documentation is value, replacing any documentation it had.

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val documented = Book.schema
 .doc("A book in the catalogue")
 .doc(Book.title, "The title on the cover")

val bookDoc  = documented.doc.toString.trim             // A book in the catalogue
val titleDoc = documented.doc(Book.title).toString.trim // The title on the cover

Attributes

See also
Source
Schema.scala
def doc[B](optic: Optic[A, B]): Doc
Implicitly added by chunk

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Attributes

Source
Schema.scala
def doc[B](optic: Optic[A, B], value: String): Schema[A]
Implicitly added by chunk

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def doc: Doc
Implicitly added by indexedSeq

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Attributes

Source
Schema.scala
def doc(value: String): Schema[A]
Implicitly added by indexedSeq

Returns a schema whose documentation is value, replacing any documentation it had.

Returns a schema whose documentation is value, replacing any documentation it had.

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val documented = Book.schema
 .doc("A book in the catalogue")
 .doc(Book.title, "The title on the cover")

val bookDoc  = documented.doc.toString.trim             // A book in the catalogue
val titleDoc = documented.doc(Book.title).toString.trim // The title on the cover

Attributes

See also
Source
Schema.scala
def doc[B](optic: Optic[A, B]): Doc
Implicitly added by indexedSeq

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Attributes

Source
Schema.scala
def doc[B](optic: Optic[A, B], value: String): Schema[A]
Implicitly added by indexedSeq

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def doc: Doc
Implicitly added by list

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Attributes

Source
Schema.scala
def doc(value: String): Schema[A]
Implicitly added by list

Returns a schema whose documentation is value, replacing any documentation it had.

Returns a schema whose documentation is value, replacing any documentation it had.

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val documented = Book.schema
 .doc("A book in the catalogue")
 .doc(Book.title, "The title on the cover")

val bookDoc  = documented.doc.toString.trim             // A book in the catalogue
val titleDoc = documented.doc(Book.title).toString.trim // The title on the cover

Attributes

See also
Source
Schema.scala
def doc[B](optic: Optic[A, B]): Doc
Implicitly added by list

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Attributes

Source
Schema.scala
def doc[B](optic: Optic[A, B], value: String): Schema[A]
Implicitly added by list

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def doc: Doc
Implicitly added by maybe

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Attributes

Source
Schema.scala
def doc(value: String): Schema[A]
Implicitly added by maybe

Returns a schema whose documentation is value, replacing any documentation it had.

Returns a schema whose documentation is value, replacing any documentation it had.

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val documented = Book.schema
 .doc("A book in the catalogue")
 .doc(Book.title, "The title on the cover")

val bookDoc  = documented.doc.toString.trim             // A book in the catalogue
val titleDoc = documented.doc(Book.title).toString.trim // The title on the cover

Attributes

See also
Source
Schema.scala
def doc[B](optic: Optic[A, B]): Doc
Implicitly added by maybe

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Attributes

Source
Schema.scala
def doc[B](optic: Optic[A, B], value: String): Schema[A]
Implicitly added by maybe

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def doc: Doc
Implicitly added by option

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Attributes

Source
Schema.scala
def doc(value: String): Schema[A]
Implicitly added by option

Returns a schema whose documentation is value, replacing any documentation it had.

Returns a schema whose documentation is value, replacing any documentation it had.

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val documented = Book.schema
 .doc("A book in the catalogue")
 .doc(Book.title, "The title on the cover")

val bookDoc  = documented.doc.toString.trim             // A book in the catalogue
val titleDoc = documented.doc(Book.title).toString.trim // The title on the cover

Attributes

See also
Source
Schema.scala
def doc[B](optic: Optic[A, B]): Doc
Implicitly added by option

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Attributes

Source
Schema.scala
def doc[B](optic: Optic[A, B], value: String): Schema[A]
Implicitly added by option

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def doc: Doc
Implicitly added by seq

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Attributes

Source
Schema.scala
def doc(value: String): Schema[A]
Implicitly added by seq

Returns a schema whose documentation is value, replacing any documentation it had.

Returns a schema whose documentation is value, replacing any documentation it had.

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val documented = Book.schema
 .doc("A book in the catalogue")
 .doc(Book.title, "The title on the cover")

val bookDoc  = documented.doc.toString.trim             // A book in the catalogue
val titleDoc = documented.doc(Book.title).toString.trim // The title on the cover

Attributes

See also
Source
Schema.scala
def doc[B](optic: Optic[A, B]): Doc
Implicitly added by seq

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Attributes

Source
Schema.scala
def doc[B](optic: Optic[A, B], value: String): Schema[A]
Implicitly added by seq

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def doc: Doc
Implicitly added by set

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Attributes

Source
Schema.scala
def doc(value: String): Schema[A]
Implicitly added by set

Returns a schema whose documentation is value, replacing any documentation it had.

Returns a schema whose documentation is value, replacing any documentation it had.

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val documented = Book.schema
 .doc("A book in the catalogue")
 .doc(Book.title, "The title on the cover")

val bookDoc  = documented.doc.toString.trim             // A book in the catalogue
val titleDoc = documented.doc(Book.title).toString.trim // The title on the cover

Attributes

See also
Source
Schema.scala
def doc[B](optic: Optic[A, B]): Doc
Implicitly added by set

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Attributes

Source
Schema.scala
def doc[B](optic: Optic[A, B], value: String): Schema[A]
Implicitly added by set

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def doc: Doc
Implicitly added by vector

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Attributes

Source
Schema.scala
def doc(value: String): Schema[A]
Implicitly added by vector

Returns a schema whose documentation is value, replacing any documentation it had.

Returns a schema whose documentation is value, replacing any documentation it had.

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val documented = Book.schema
 .doc("A book in the catalogue")
 .doc(Book.title, "The title on the cover")

val bookDoc  = documented.doc.toString.trim             // A book in the catalogue
val titleDoc = documented.doc(Book.title).toString.trim // The title on the cover

Attributes

See also
Source
Schema.scala
def doc[B](optic: Optic[A, B]): Doc
Implicitly added by vector

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Attributes

Source
Schema.scala
def doc[B](optic: Optic[A, B], value: String): Schema[A]
Implicitly added by vector

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def doc: Doc

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Returns the documentation of A stored in this schema, or Doc.empty when there is none.

Attributes

Source
Schema.scala
def doc(value: String): Schema[A]

Returns a schema whose documentation is value, replacing any documentation it had.

Returns a schema whose documentation is value, replacing any documentation it had.

case class Book(title: String, year: Int)
object Book extends CompanionOptics[Book] {
 implicit val schema: Schema[Book] = Schema.derived
 val title: Lens[Book, String]     = $(_.title)
}

val documented = Book.schema
 .doc("A book in the catalogue")
 .doc(Book.title, "The title on the cover")

val bookDoc  = documented.doc.toString.trim             // A book in the catalogue
val titleDoc = documented.doc(Book.title).toString.trim // The title on the cover

Attributes

See also
Source
Schema.scala
def doc[B](optic: Optic[A, B]): Doc

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Returns the documentation of the part of A that optic focuses on, or Doc.empty when the optic does not resolve or the part has none.

Attributes

Source
Schema.scala
def doc[B](optic: Optic[A, B], value: String): Schema[A]

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the documentation value. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def encode[F <: Format](format: F)(output: format.EncodeOutput)(value: A): Unit
Implicitly added by chunk

Encodes value into output with the codec of format, the one getInstance returns.

Encodes value into output with the codec of format, the one getInstance returns.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val buffer = ByteBuffer.allocate(256)
Book.schema.encode(JsonFormat)(buffer)(Book("Zionomicon", 2021))
buffer.flip()
val json = StandardCharsets.UTF_8.decode(buffer).toString // {"title":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def encode[F <: Format](format: F)(output: format.EncodeOutput)(value: A): Unit
Implicitly added by indexedSeq

Encodes value into output with the codec of format, the one getInstance returns.

Encodes value into output with the codec of format, the one getInstance returns.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val buffer = ByteBuffer.allocate(256)
Book.schema.encode(JsonFormat)(buffer)(Book("Zionomicon", 2021))
buffer.flip()
val json = StandardCharsets.UTF_8.decode(buffer).toString // {"title":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def encode[F <: Format](format: F)(output: format.EncodeOutput)(value: A): Unit
Implicitly added by list

Encodes value into output with the codec of format, the one getInstance returns.

Encodes value into output with the codec of format, the one getInstance returns.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val buffer = ByteBuffer.allocate(256)
Book.schema.encode(JsonFormat)(buffer)(Book("Zionomicon", 2021))
buffer.flip()
val json = StandardCharsets.UTF_8.decode(buffer).toString // {"title":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def encode[F <: Format](format: F)(output: format.EncodeOutput)(value: A): Unit
Implicitly added by maybe

Encodes value into output with the codec of format, the one getInstance returns.

Encodes value into output with the codec of format, the one getInstance returns.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val buffer = ByteBuffer.allocate(256)
Book.schema.encode(JsonFormat)(buffer)(Book("Zionomicon", 2021))
buffer.flip()
val json = StandardCharsets.UTF_8.decode(buffer).toString // {"title":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def encode[F <: Format](format: F)(output: format.EncodeOutput)(value: A): Unit
Implicitly added by option

Encodes value into output with the codec of format, the one getInstance returns.

Encodes value into output with the codec of format, the one getInstance returns.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val buffer = ByteBuffer.allocate(256)
Book.schema.encode(JsonFormat)(buffer)(Book("Zionomicon", 2021))
buffer.flip()
val json = StandardCharsets.UTF_8.decode(buffer).toString // {"title":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def encode[F <: Format](format: F)(output: format.EncodeOutput)(value: A): Unit
Implicitly added by seq

Encodes value into output with the codec of format, the one getInstance returns.

Encodes value into output with the codec of format, the one getInstance returns.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val buffer = ByteBuffer.allocate(256)
Book.schema.encode(JsonFormat)(buffer)(Book("Zionomicon", 2021))
buffer.flip()
val json = StandardCharsets.UTF_8.decode(buffer).toString // {"title":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def encode[F <: Format](format: F)(output: format.EncodeOutput)(value: A): Unit
Implicitly added by set

Encodes value into output with the codec of format, the one getInstance returns.

Encodes value into output with the codec of format, the one getInstance returns.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val buffer = ByteBuffer.allocate(256)
Book.schema.encode(JsonFormat)(buffer)(Book("Zionomicon", 2021))
buffer.flip()
val json = StandardCharsets.UTF_8.decode(buffer).toString // {"title":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def encode[F <: Format](format: F)(output: format.EncodeOutput)(value: A): Unit
Implicitly added by vector

Encodes value into output with the codec of format, the one getInstance returns.

Encodes value into output with the codec of format, the one getInstance returns.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val buffer = ByteBuffer.allocate(256)
Book.schema.encode(JsonFormat)(buffer)(Book("Zionomicon", 2021))
buffer.flip()
val json = StandardCharsets.UTF_8.decode(buffer).toString // {"title":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def encode[F <: Format](format: F)(output: format.EncodeOutput)(value: A): Unit

Encodes value into output with the codec of format, the one getInstance returns.

Encodes value into output with the codec of format, the one getInstance returns.

import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import zio.blocks.schema.json.JsonFormat

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val buffer = ByteBuffer.allocate(256)
Book.schema.encode(JsonFormat)(buffer)(Book("Zionomicon", 2021))
buffer.flip()
val json = StandardCharsets.UTF_8.decode(buffer).toString // {"title":"Zionomicon","year":2021}

Attributes

See also
Source
Schema.scala
def examples: Seq[A]
Implicitly added by chunk

Returns the example values of A stored in this schema.

Returns the example values of A stored in this schema.

Attributes

Source
Schema.scala
def examples(value: A, values: A*): Schema[A]
Implicitly added by chunk

Returns a schema whose examples are value and values, replacing any examples it had.

Returns a schema whose examples are value and values, replacing any examples it had.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B]): Seq[B]
Implicitly added by chunk

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B], value: B, values: B*): Schema[A]
Implicitly added by chunk

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def examples: Seq[A]
Implicitly added by indexedSeq

Returns the example values of A stored in this schema.

Returns the example values of A stored in this schema.

Attributes

Source
Schema.scala
def examples(value: A, values: A*): Schema[A]
Implicitly added by indexedSeq

Returns a schema whose examples are value and values, replacing any examples it had.

Returns a schema whose examples are value and values, replacing any examples it had.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B]): Seq[B]
Implicitly added by indexedSeq

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B], value: B, values: B*): Schema[A]
Implicitly added by indexedSeq

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def examples: Seq[A]
Implicitly added by list

Returns the example values of A stored in this schema.

Returns the example values of A stored in this schema.

Attributes

Source
Schema.scala
def examples(value: A, values: A*): Schema[A]
Implicitly added by list

Returns a schema whose examples are value and values, replacing any examples it had.

Returns a schema whose examples are value and values, replacing any examples it had.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B]): Seq[B]
Implicitly added by list

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B], value: B, values: B*): Schema[A]
Implicitly added by list

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def examples: Seq[A]
Implicitly added by maybe

Returns the example values of A stored in this schema.

Returns the example values of A stored in this schema.

Attributes

Source
Schema.scala
def examples(value: A, values: A*): Schema[A]
Implicitly added by maybe

Returns a schema whose examples are value and values, replacing any examples it had.

Returns a schema whose examples are value and values, replacing any examples it had.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B]): Seq[B]
Implicitly added by maybe

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B], value: B, values: B*): Schema[A]
Implicitly added by maybe

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def examples: Seq[A]
Implicitly added by option

Returns the example values of A stored in this schema.

Returns the example values of A stored in this schema.

Attributes

Source
Schema.scala
def examples(value: A, values: A*): Schema[A]
Implicitly added by option

Returns a schema whose examples are value and values, replacing any examples it had.

Returns a schema whose examples are value and values, replacing any examples it had.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B]): Seq[B]
Implicitly added by option

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B], value: B, values: B*): Schema[A]
Implicitly added by option

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def examples: Seq[A]
Implicitly added by seq

Returns the example values of A stored in this schema.

Returns the example values of A stored in this schema.

Attributes

Source
Schema.scala
def examples(value: A, values: A*): Schema[A]
Implicitly added by seq

Returns a schema whose examples are value and values, replacing any examples it had.

Returns a schema whose examples are value and values, replacing any examples it had.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B]): Seq[B]
Implicitly added by seq

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B], value: B, values: B*): Schema[A]
Implicitly added by seq

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def examples: Seq[A]
Implicitly added by set

Returns the example values of A stored in this schema.

Returns the example values of A stored in this schema.

Attributes

Source
Schema.scala
def examples(value: A, values: A*): Schema[A]
Implicitly added by set

Returns a schema whose examples are value and values, replacing any examples it had.

Returns a schema whose examples are value and values, replacing any examples it had.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B]): Seq[B]
Implicitly added by set

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B], value: B, values: B*): Schema[A]
Implicitly added by set

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def examples: Seq[A]
Implicitly added by vector

Returns the example values of A stored in this schema.

Returns the example values of A stored in this schema.

Attributes

Source
Schema.scala
def examples(value: A, values: A*): Schema[A]
Implicitly added by vector

Returns a schema whose examples are value and values, replacing any examples it had.

Returns a schema whose examples are value and values, replacing any examples it had.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B]): Seq[B]
Implicitly added by vector

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B], value: B, values: B*): Schema[A]
Implicitly added by vector

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def examples: Seq[A]

Returns the example values of A stored in this schema.

Returns the example values of A stored in this schema.

Attributes

Source
Schema.scala
def examples(value: A, values: A*): Schema[A]

Returns a schema whose examples are value and values, replacing any examples it had.

Returns a schema whose examples are value and values, replacing any examples it had.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B]): Seq[B]

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Returns the examples of the part of A that optic focuses on, or an empty Seq when the optic does not resolve.

Attributes

Source
Schema.scala
def examples[B](optic: Optic[A, B], value: B, values: B*): Schema[A]

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Returns a schema in which the part of A that optic focuses on has the examples value and values. When the optic does not resolve against this schema, this schema is returned unchanged.

Attributes

Source
Schema.scala
def fromDynamicValue(value: DynamicValue): Either[SchemaError, A]
Implicitly added by chunk

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Attributes

Source
Schema.scala
def fromDynamicValue(value: DynamicValue): Either[SchemaError, A]
Implicitly added by indexedSeq

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Attributes

Source
Schema.scala
def fromDynamicValue(value: DynamicValue): Either[SchemaError, A]
Implicitly added by list

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Attributes

Source
Schema.scala
def fromDynamicValue(value: DynamicValue): Either[SchemaError, A]
Implicitly added by maybe

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Attributes

Source
Schema.scala
def fromDynamicValue(value: DynamicValue): Either[SchemaError, A]
Implicitly added by option

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Attributes

Source
Schema.scala
def fromDynamicValue(value: DynamicValue): Either[SchemaError, A]
Implicitly added by seq

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Attributes

Source
Schema.scala
def fromDynamicValue(value: DynamicValue): Either[SchemaError, A]
Implicitly added by set

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Attributes

Source
Schema.scala
def fromDynamicValue(value: DynamicValue): Either[SchemaError, A]
Implicitly added by vector

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Attributes

Source
Schema.scala
def fromDynamicValue(value: DynamicValue): Either[SchemaError, A]

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Converts value to a value of A. Returns Left when value does not match this schema, with the failures of all record fields collected in one SchemaError, or when a transform function throws.

Attributes

Source
Schema.scala
def get[B](optic: Optic[A, B]): Option[Bound[B]]
Implicitly added by chunk

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala
def get(dynamic: DynamicOptic): Option[Reflect[Binding, _]]
Implicitly added by chunk

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def get[B](optic: Optic[A, B]): Option[Bound[B]]
Implicitly added by indexedSeq

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala
def get(dynamic: DynamicOptic): Option[Reflect[Binding, _]]
Implicitly added by indexedSeq

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def get[B](optic: Optic[A, B]): Option[Bound[B]]
Implicitly added by list

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala
def get(dynamic: DynamicOptic): Option[Reflect[Binding, _]]
Implicitly added by list

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def get[B](optic: Optic[A, B]): Option[Bound[B]]
Implicitly added by maybe

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala
def get(dynamic: DynamicOptic): Option[Reflect[Binding, _]]
Implicitly added by maybe

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def get[B](optic: Optic[A, B]): Option[Bound[B]]
Implicitly added by option

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala
def get(dynamic: DynamicOptic): Option[Reflect[Binding, _]]
Implicitly added by option

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def get[B](optic: Optic[A, B]): Option[Bound[B]]
Implicitly added by seq

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala
def get(dynamic: DynamicOptic): Option[Reflect[Binding, _]]
Implicitly added by seq

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def get[B](optic: Optic[A, B]): Option[Bound[B]]
Implicitly added by set

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala
def get(dynamic: DynamicOptic): Option[Reflect[Binding, _]]
Implicitly added by set

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def get[B](optic: Optic[A, B]): Option[Bound[B]]
Implicitly added by vector

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala
def get(dynamic: DynamicOptic): Option[Reflect[Binding, _]]
Implicitly added by vector

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def get[B](optic: Optic[A, B]): Option[Bound[B]]

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns the structure of the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala
def get(dynamic: DynamicOptic): Option[Reflect[Binding, _]]

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns the structure of the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def getDefaultValue: Option[A]
Implicitly added by chunk

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Attributes

Source
Schema.scala
def getDefaultValue[B](optic: Optic[A, B]): Option[B]
Implicitly added by chunk

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Attributes

Source
Schema.scala
def getDefaultValue: Option[A]
Implicitly added by indexedSeq

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Attributes

Source
Schema.scala
def getDefaultValue[B](optic: Optic[A, B]): Option[B]
Implicitly added by indexedSeq

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Attributes

Source
Schema.scala
def getDefaultValue: Option[A]
Implicitly added by list

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Attributes

Source
Schema.scala
def getDefaultValue[B](optic: Optic[A, B]): Option[B]
Implicitly added by list

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Attributes

Source
Schema.scala
def getDefaultValue: Option[A]
Implicitly added by maybe

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Attributes

Source
Schema.scala
def getDefaultValue[B](optic: Optic[A, B]): Option[B]
Implicitly added by maybe

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Attributes

Source
Schema.scala
def getDefaultValue: Option[A]
Implicitly added by option

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Attributes

Source
Schema.scala
def getDefaultValue[B](optic: Optic[A, B]): Option[B]
Implicitly added by option

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Attributes

Source
Schema.scala
def getDefaultValue: Option[A]
Implicitly added by seq

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Attributes

Source
Schema.scala
def getDefaultValue[B](optic: Optic[A, B]): Option[B]
Implicitly added by seq

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Attributes

Source
Schema.scala
def getDefaultValue: Option[A]
Implicitly added by set

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Attributes

Source
Schema.scala
def getDefaultValue[B](optic: Optic[A, B]): Option[B]
Implicitly added by set

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Attributes

Source
Schema.scala
def getDefaultValue: Option[A]
Implicitly added by vector

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Attributes

Source
Schema.scala
def getDefaultValue[B](optic: Optic[A, B]): Option[B]
Implicitly added by vector

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Attributes

Source
Schema.scala
def getDefaultValue: Option[A]

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Returns the default value of A set with defaultValue, or None when there is none. A derived schema stores the defaults of case class fields on the fields, not on the record: read them with the overload that takes an optic.

Attributes

Source
Schema.scala
def getDefaultValue[B](optic: Optic[A, B]): Option[B]

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Returns the default value of the part of A that optic focuses on, such as the default of a case class field, or None when the optic does not resolve or the part has no default.

Attributes

Source
Schema.scala
def getInstance[F <: Format](format: F): format.TypeClass[A]
Implicitly added by chunk

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

The cache belongs to this Schema value, so a schema returned by doc, modifier or any other update derives its codec again.

import zio.blocks.schema.json.{JsonCodec, JsonFormat}

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val codec: JsonCodec[Book] = Book.schema.getInstance(JsonFormat)
val cached                 = codec eq Book.schema.getInstance(JsonFormat) // true

Attributes

Source
Schema.scala
def getInstance[F <: Format](format: F): format.TypeClass[A]
Implicitly added by indexedSeq

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

The cache belongs to this Schema value, so a schema returned by doc, modifier or any other update derives its codec again.

import zio.blocks.schema.json.{JsonCodec, JsonFormat}

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val codec: JsonCodec[Book] = Book.schema.getInstance(JsonFormat)
val cached                 = codec eq Book.schema.getInstance(JsonFormat) // true

Attributes

Source
Schema.scala
def getInstance[F <: Format](format: F): format.TypeClass[A]
Implicitly added by list

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

The cache belongs to this Schema value, so a schema returned by doc, modifier or any other update derives its codec again.

import zio.blocks.schema.json.{JsonCodec, JsonFormat}

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val codec: JsonCodec[Book] = Book.schema.getInstance(JsonFormat)
val cached                 = codec eq Book.schema.getInstance(JsonFormat) // true

Attributes

Source
Schema.scala
def getInstance[F <: Format](format: F): format.TypeClass[A]
Implicitly added by maybe

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

The cache belongs to this Schema value, so a schema returned by doc, modifier or any other update derives its codec again.

import zio.blocks.schema.json.{JsonCodec, JsonFormat}

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val codec: JsonCodec[Book] = Book.schema.getInstance(JsonFormat)
val cached                 = codec eq Book.schema.getInstance(JsonFormat) // true

Attributes

Source
Schema.scala
def getInstance[F <: Format](format: F): format.TypeClass[A]
Implicitly added by option

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

The cache belongs to this Schema value, so a schema returned by doc, modifier or any other update derives its codec again.

import zio.blocks.schema.json.{JsonCodec, JsonFormat}

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val codec: JsonCodec[Book] = Book.schema.getInstance(JsonFormat)
val cached                 = codec eq Book.schema.getInstance(JsonFormat) // true

Attributes

Source
Schema.scala
def getInstance[F <: Format](format: F): format.TypeClass[A]
Implicitly added by seq

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

The cache belongs to this Schema value, so a schema returned by doc, modifier or any other update derives its codec again.

import zio.blocks.schema.json.{JsonCodec, JsonFormat}

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val codec: JsonCodec[Book] = Book.schema.getInstance(JsonFormat)
val cached                 = codec eq Book.schema.getInstance(JsonFormat) // true

Attributes

Source
Schema.scala
def getInstance[F <: Format](format: F): format.TypeClass[A]
Implicitly added by set

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

The cache belongs to this Schema value, so a schema returned by doc, modifier or any other update derives its codec again.

import zio.blocks.schema.json.{JsonCodec, JsonFormat}

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val codec: JsonCodec[Book] = Book.schema.getInstance(JsonFormat)
val cached                 = codec eq Book.schema.getInstance(JsonFormat) // true

Attributes

Source
Schema.scala
def getInstance[F <: Format](format: F): format.TypeClass[A]
Implicitly added by vector

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

The cache belongs to this Schema value, so a schema returned by doc, modifier or any other update derives its codec again.

import zio.blocks.schema.json.{JsonCodec, JsonFormat}

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val codec: JsonCodec[Book] = Book.schema.getInstance(JsonFormat)
val cached                 = codec eq Book.schema.getInstance(JsonFormat) // true

Attributes

Source
Schema.scala
def getInstance[F <: Format](format: F): format.TypeClass[A]

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

Returns the codec of format for A. The first call derives it with the format's default deriver, format.deriver; later calls with the same format return the cached instance.

The cache belongs to this Schema value, so a schema returned by doc, modifier or any other update derives its codec again.

import zio.blocks.schema.json.{JsonCodec, JsonFormat}

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val codec: JsonCodec[Book] = Book.schema.getInstance(JsonFormat)
val cached                 = codec eq Book.schema.getInstance(JsonFormat) // true

Attributes

Source
Schema.scala
def modifier(modifier: Reflect): Schema[A]
Implicitly added by chunk

Returns a schema with modifier added after the modifiers that A already has.

Returns a schema with modifier added after the modifiers that A already has.

Attributes

Source
Schema.scala
def modifier(modifier: Reflect): Schema[A]
Implicitly added by indexedSeq

Returns a schema with modifier added after the modifiers that A already has.

Returns a schema with modifier added after the modifiers that A already has.

Attributes

Source
Schema.scala
def modifier(modifier: Reflect): Schema[A]
Implicitly added by list

Returns a schema with modifier added after the modifiers that A already has.

Returns a schema with modifier added after the modifiers that A already has.

Attributes

Source
Schema.scala
def modifier(modifier: Reflect): Schema[A]
Implicitly added by maybe

Returns a schema with modifier added after the modifiers that A already has.

Returns a schema with modifier added after the modifiers that A already has.

Attributes

Source
Schema.scala
def modifier(modifier: Reflect): Schema[A]
Implicitly added by option

Returns a schema with modifier added after the modifiers that A already has.

Returns a schema with modifier added after the modifiers that A already has.

Attributes

Source
Schema.scala
def modifier(modifier: Reflect): Schema[A]
Implicitly added by seq

Returns a schema with modifier added after the modifiers that A already has.

Returns a schema with modifier added after the modifiers that A already has.

Attributes

Source
Schema.scala
def modifier(modifier: Reflect): Schema[A]
Implicitly added by set

Returns a schema with modifier added after the modifiers that A already has.

Returns a schema with modifier added after the modifiers that A already has.

Attributes

Source
Schema.scala
def modifier(modifier: Reflect): Schema[A]
Implicitly added by vector

Returns a schema with modifier added after the modifiers that A already has.

Returns a schema with modifier added after the modifiers that A already has.

Attributes

Source
Schema.scala
def modifier(modifier: Reflect): Schema[A]

Returns a schema with modifier added after the modifiers that A already has.

Returns a schema with modifier added after the modifiers that A already has.

Attributes

Source
Schema.scala
def modifiers(modifiers: Iterable[Reflect]): Schema[A]
Implicitly added by chunk

Returns a schema with modifiers added after the modifiers that A already has.

Returns a schema with modifiers added after the modifiers that A already has.

Attributes

Source
Schema.scala
def modifiers(modifiers: Iterable[Reflect]): Schema[A]
Implicitly added by indexedSeq

Returns a schema with modifiers added after the modifiers that A already has.

Returns a schema with modifiers added after the modifiers that A already has.

Attributes

Source
Schema.scala
def modifiers(modifiers: Iterable[Reflect]): Schema[A]
Implicitly added by list

Returns a schema with modifiers added after the modifiers that A already has.

Returns a schema with modifiers added after the modifiers that A already has.

Attributes

Source
Schema.scala
def modifiers(modifiers: Iterable[Reflect]): Schema[A]
Implicitly added by maybe

Returns a schema with modifiers added after the modifiers that A already has.

Returns a schema with modifiers added after the modifiers that A already has.

Attributes

Source
Schema.scala
def modifiers(modifiers: Iterable[Reflect]): Schema[A]
Implicitly added by option

Returns a schema with modifiers added after the modifiers that A already has.

Returns a schema with modifiers added after the modifiers that A already has.

Attributes

Source
Schema.scala
def modifiers(modifiers: Iterable[Reflect]): Schema[A]
Implicitly added by seq

Returns a schema with modifiers added after the modifiers that A already has.

Returns a schema with modifiers added after the modifiers that A already has.

Attributes

Source
Schema.scala
def modifiers(modifiers: Iterable[Reflect]): Schema[A]
Implicitly added by set

Returns a schema with modifiers added after the modifiers that A already has.

Returns a schema with modifiers added after the modifiers that A already has.

Attributes

Source
Schema.scala
def modifiers(modifiers: Iterable[Reflect]): Schema[A]
Implicitly added by vector

Returns a schema with modifiers added after the modifiers that A already has.

Returns a schema with modifiers added after the modifiers that A already has.

Attributes

Source
Schema.scala
def modifiers(modifiers: Iterable[Reflect]): Schema[A]

Returns a schema with modifiers added after the modifiers that A already has.

Returns a schema with modifiers added after the modifiers that A already has.

Attributes

Source
Schema.scala
def patch(value: A, patch: Patch[A]): Either[SchemaError, A]
Implicitly added by chunk

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Attributes

Source
Schema.scala
def patch(value: A, patch: Patch[A]): Either[SchemaError, A]
Implicitly added by indexedSeq

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Attributes

Source
Schema.scala
def patch(value: A, patch: Patch[A]): Either[SchemaError, A]
Implicitly added by list

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Attributes

Source
Schema.scala
def patch(value: A, patch: Patch[A]): Either[SchemaError, A]
Implicitly added by maybe

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Attributes

Source
Schema.scala
def patch(value: A, patch: Patch[A]): Either[SchemaError, A]
Implicitly added by option

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Attributes

Source
Schema.scala
def patch(value: A, patch: Patch[A]): Either[SchemaError, A]
Implicitly added by seq

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Attributes

Source
Schema.scala
def patch(value: A, patch: Patch[A]): Either[SchemaError, A]
Implicitly added by set

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Attributes

Source
Schema.scala
def patch(value: A, patch: Patch[A]): Either[SchemaError, A]
Implicitly added by vector

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Attributes

Source
Schema.scala
def patch(value: A, patch: Patch[A]): Either[SchemaError, A]

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Applies patch to value in strict mode: returns Left when an operation of the patch cannot be applied, or when the result does not convert back to A.

Attributes

Source
Schema.scala
Implicitly added by chunk

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Its check does not run the checks of transform functions, because they live in the bindings it drops.

Attributes

Source
Schema.scala
Implicitly added by indexedSeq

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Its check does not run the checks of transform functions, because they live in the bindings it drops.

Attributes

Source
Schema.scala
Implicitly added by list

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Its check does not run the checks of transform functions, because they live in the bindings it drops.

Attributes

Source
Schema.scala
Implicitly added by maybe

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Its check does not run the checks of transform functions, because they live in the bindings it drops.

Attributes

Source
Schema.scala
Implicitly added by option

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Its check does not run the checks of transform functions, because they live in the bindings it drops.

Attributes

Source
Schema.scala
Implicitly added by seq

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Its check does not run the checks of transform functions, because they live in the bindings it drops.

Attributes

Source
Schema.scala
Implicitly added by set

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Its check does not run the checks of transform functions, because they live in the bindings it drops.

Attributes

Source
Schema.scala
Implicitly added by vector

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Its check does not run the checks of transform functions, because they live in the bindings it drops.

Attributes

Source
Schema.scala

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Converts this schema to a DynamicSchema by dropping its bindings. The result keeps the structure (fields, cases, types and Validation constraints) but cannot build values of A; use it to check DynamicValue instances against the structure.

Its check does not run the checks of transform functions, because they live in the bindings it drops.

Attributes

Source
Schema.scala
def toDynamicValue(value: A): DynamicValue
Implicitly added by chunk

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Attributes

Source
Schema.scala
def toDynamicValue(value: A): DynamicValue
Implicitly added by indexedSeq

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Attributes

Source
Schema.scala
def toDynamicValue(value: A): DynamicValue
Implicitly added by list

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Attributes

Source
Schema.scala
def toDynamicValue(value: A): DynamicValue
Implicitly added by maybe

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Attributes

Source
Schema.scala
def toDynamicValue(value: A): DynamicValue
Implicitly added by option

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Attributes

Source
Schema.scala
def toDynamicValue(value: A): DynamicValue
Implicitly added by seq

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Attributes

Source
Schema.scala
def toDynamicValue(value: A): DynamicValue
Implicitly added by set

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Attributes

Source
Schema.scala
def toDynamicValue(value: A): DynamicValue
Implicitly added by vector

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Attributes

Source
Schema.scala
def toDynamicValue(value: A): DynamicValue

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Converts value to a DynamicValue that follows this schema. An exception thrown by the from function of a transform on the way propagates to the caller.

Attributes

Source
Schema.scala
Implicitly added by chunk

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Attributes

Source
Schema.scala
Implicitly added by indexedSeq

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Attributes

Source
Schema.scala
Implicitly added by list

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Attributes

Source
Schema.scala
Implicitly added by maybe

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Attributes

Source
Schema.scala
Implicitly added by option

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Attributes

Source
Schema.scala
Implicitly added by seq

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Attributes

Source
Schema.scala
Implicitly added by set

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Attributes

Source
Schema.scala
Implicitly added by vector

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Attributes

Source
Schema.scala

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Derives a JSON Schema from this schema. Validation constraints are not included in it.

Attributes

Source
Schema.scala
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
Source
Schema.scala
def transform[B](to: A => B, from: B => A)(implicit typeId: TypeId[B]): Schema[B]
Implicitly added by chunk

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

to runs when a value is decoded, by a codec or by fromDynamicValue, and may throw to reject the value, for example with SchemaError.validationFailed. The decoder then returns Left with the message of the exception at a path that ends in .wrapped, the step into the wrapped A. from runs when a value is encoded or converted with toDynamicValue, and neither catches an exception it throws: toDynamicValue rethrows it unchanged, and the JSON codec throws it as a JsonCodecError that keeps its message.

DynamicSchema#check does not run the checks in to.

final case class PageCount(value: Int)
object PageCount {
 implicit val schema: Schema[PageCount] = Schema[Int].transform(
   n => if (n > 0) PageCount(n) else throw SchemaError.validationFailed("page count must be positive, got " + n),
   _.value
 )
}

val pages   = "816".fromJson[PageCount] // Right(PageCount(816))
val invalid = "-5".fromJson[PageCount]
// Left(zio.blocks.schema.SchemaError: page count must be positive, got -5 at: .wrapped)

Attributes

See also
Source
Schema.scala
def transform[B](to: A => B, from: B => A)(implicit typeId: TypeId[B]): Schema[B]
Implicitly added by indexedSeq

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

to runs when a value is decoded, by a codec or by fromDynamicValue, and may throw to reject the value, for example with SchemaError.validationFailed. The decoder then returns Left with the message of the exception at a path that ends in .wrapped, the step into the wrapped A. from runs when a value is encoded or converted with toDynamicValue, and neither catches an exception it throws: toDynamicValue rethrows it unchanged, and the JSON codec throws it as a JsonCodecError that keeps its message.

DynamicSchema#check does not run the checks in to.

final case class PageCount(value: Int)
object PageCount {
 implicit val schema: Schema[PageCount] = Schema[Int].transform(
   n => if (n > 0) PageCount(n) else throw SchemaError.validationFailed("page count must be positive, got " + n),
   _.value
 )
}

val pages   = "816".fromJson[PageCount] // Right(PageCount(816))
val invalid = "-5".fromJson[PageCount]
// Left(zio.blocks.schema.SchemaError: page count must be positive, got -5 at: .wrapped)

Attributes

See also
Source
Schema.scala
def transform[B](to: A => B, from: B => A)(implicit typeId: TypeId[B]): Schema[B]
Implicitly added by list

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

to runs when a value is decoded, by a codec or by fromDynamicValue, and may throw to reject the value, for example with SchemaError.validationFailed. The decoder then returns Left with the message of the exception at a path that ends in .wrapped, the step into the wrapped A. from runs when a value is encoded or converted with toDynamicValue, and neither catches an exception it throws: toDynamicValue rethrows it unchanged, and the JSON codec throws it as a JsonCodecError that keeps its message.

DynamicSchema#check does not run the checks in to.

final case class PageCount(value: Int)
object PageCount {
 implicit val schema: Schema[PageCount] = Schema[Int].transform(
   n => if (n > 0) PageCount(n) else throw SchemaError.validationFailed("page count must be positive, got " + n),
   _.value
 )
}

val pages   = "816".fromJson[PageCount] // Right(PageCount(816))
val invalid = "-5".fromJson[PageCount]
// Left(zio.blocks.schema.SchemaError: page count must be positive, got -5 at: .wrapped)

Attributes

See also
Source
Schema.scala
def transform[B](to: A => B, from: B => A)(implicit typeId: TypeId[B]): Schema[B]
Implicitly added by maybe

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

to runs when a value is decoded, by a codec or by fromDynamicValue, and may throw to reject the value, for example with SchemaError.validationFailed. The decoder then returns Left with the message of the exception at a path that ends in .wrapped, the step into the wrapped A. from runs when a value is encoded or converted with toDynamicValue, and neither catches an exception it throws: toDynamicValue rethrows it unchanged, and the JSON codec throws it as a JsonCodecError that keeps its message.

DynamicSchema#check does not run the checks in to.

final case class PageCount(value: Int)
object PageCount {
 implicit val schema: Schema[PageCount] = Schema[Int].transform(
   n => if (n > 0) PageCount(n) else throw SchemaError.validationFailed("page count must be positive, got " + n),
   _.value
 )
}

val pages   = "816".fromJson[PageCount] // Right(PageCount(816))
val invalid = "-5".fromJson[PageCount]
// Left(zio.blocks.schema.SchemaError: page count must be positive, got -5 at: .wrapped)

Attributes

See also
Source
Schema.scala
def transform[B](to: A => B, from: B => A)(implicit typeId: TypeId[B]): Schema[B]
Implicitly added by option

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

to runs when a value is decoded, by a codec or by fromDynamicValue, and may throw to reject the value, for example with SchemaError.validationFailed. The decoder then returns Left with the message of the exception at a path that ends in .wrapped, the step into the wrapped A. from runs when a value is encoded or converted with toDynamicValue, and neither catches an exception it throws: toDynamicValue rethrows it unchanged, and the JSON codec throws it as a JsonCodecError that keeps its message.

DynamicSchema#check does not run the checks in to.

final case class PageCount(value: Int)
object PageCount {
 implicit val schema: Schema[PageCount] = Schema[Int].transform(
   n => if (n > 0) PageCount(n) else throw SchemaError.validationFailed("page count must be positive, got " + n),
   _.value
 )
}

val pages   = "816".fromJson[PageCount] // Right(PageCount(816))
val invalid = "-5".fromJson[PageCount]
// Left(zio.blocks.schema.SchemaError: page count must be positive, got -5 at: .wrapped)

Attributes

See also
Source
Schema.scala
def transform[B](to: A => B, from: B => A)(implicit typeId: TypeId[B]): Schema[B]
Implicitly added by seq

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

to runs when a value is decoded, by a codec or by fromDynamicValue, and may throw to reject the value, for example with SchemaError.validationFailed. The decoder then returns Left with the message of the exception at a path that ends in .wrapped, the step into the wrapped A. from runs when a value is encoded or converted with toDynamicValue, and neither catches an exception it throws: toDynamicValue rethrows it unchanged, and the JSON codec throws it as a JsonCodecError that keeps its message.

DynamicSchema#check does not run the checks in to.

final case class PageCount(value: Int)
object PageCount {
 implicit val schema: Schema[PageCount] = Schema[Int].transform(
   n => if (n > 0) PageCount(n) else throw SchemaError.validationFailed("page count must be positive, got " + n),
   _.value
 )
}

val pages   = "816".fromJson[PageCount] // Right(PageCount(816))
val invalid = "-5".fromJson[PageCount]
// Left(zio.blocks.schema.SchemaError: page count must be positive, got -5 at: .wrapped)

Attributes

See also
Source
Schema.scala
def transform[B](to: A => B, from: B => A)(implicit typeId: TypeId[B]): Schema[B]
Implicitly added by set

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

to runs when a value is decoded, by a codec or by fromDynamicValue, and may throw to reject the value, for example with SchemaError.validationFailed. The decoder then returns Left with the message of the exception at a path that ends in .wrapped, the step into the wrapped A. from runs when a value is encoded or converted with toDynamicValue, and neither catches an exception it throws: toDynamicValue rethrows it unchanged, and the JSON codec throws it as a JsonCodecError that keeps its message.

DynamicSchema#check does not run the checks in to.

final case class PageCount(value: Int)
object PageCount {
 implicit val schema: Schema[PageCount] = Schema[Int].transform(
   n => if (n > 0) PageCount(n) else throw SchemaError.validationFailed("page count must be positive, got " + n),
   _.value
 )
}

val pages   = "816".fromJson[PageCount] // Right(PageCount(816))
val invalid = "-5".fromJson[PageCount]
// Left(zio.blocks.schema.SchemaError: page count must be positive, got -5 at: .wrapped)

Attributes

See also
Source
Schema.scala
def transform[B](to: A => B, from: B => A)(implicit typeId: TypeId[B]): Schema[B]
Implicitly added by vector

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

to runs when a value is decoded, by a codec or by fromDynamicValue, and may throw to reject the value, for example with SchemaError.validationFailed. The decoder then returns Left with the message of the exception at a path that ends in .wrapped, the step into the wrapped A. from runs when a value is encoded or converted with toDynamicValue, and neither catches an exception it throws: toDynamicValue rethrows it unchanged, and the JSON codec throws it as a JsonCodecError that keeps its message.

DynamicSchema#check does not run the checks in to.

final case class PageCount(value: Int)
object PageCount {
 implicit val schema: Schema[PageCount] = Schema[Int].transform(
   n => if (n > 0) PageCount(n) else throw SchemaError.validationFailed("page count must be positive, got " + n),
   _.value
 )
}

val pages   = "816".fromJson[PageCount] // Right(PageCount(816))
val invalid = "-5".fromJson[PageCount]
// Left(zio.blocks.schema.SchemaError: page count must be positive, got -5 at: .wrapped)

Attributes

See also
Source
Schema.scala
def transform[B](to: A => B, from: B => A)(implicit typeId: TypeId[B]): Schema[B]

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

Returns a schema for B that represents each B as the A that from returns. Use it for wrapper types, newtypes and validated types. The implicit TypeId[B] gives the new schema its type name.

to runs when a value is decoded, by a codec or by fromDynamicValue, and may throw to reject the value, for example with SchemaError.validationFailed. The decoder then returns Left with the message of the exception at a path that ends in .wrapped, the step into the wrapped A. from runs when a value is encoded or converted with toDynamicValue, and neither catches an exception it throws: toDynamicValue rethrows it unchanged, and the JSON codec throws it as a JsonCodecError that keeps its message.

DynamicSchema#check does not run the checks in to.

final case class PageCount(value: Int)
object PageCount {
 implicit val schema: Schema[PageCount] = Schema[Int].transform(
   n => if (n > 0) PageCount(n) else throw SchemaError.validationFailed("page count must be positive, got " + n),
   _.value
 )
}

val pages   = "816".fromJson[PageCount] // Right(PageCount(816))
val invalid = "-5".fromJson[PageCount]
// Left(zio.blocks.schema.SchemaError: page count must be positive, got -5 at: .wrapped)

Attributes

See also
Source
Schema.scala
def updated(dynamic: DynamicOptic)(f: Updater[Binding]): Option[Schema[A]]
Implicitly added by chunk

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def updated[B](optic: Optic[A, B])(f: Bound[B] => Bound[B]): Option[Schema[A]]
Implicitly added by chunk

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala
def updated(dynamic: DynamicOptic)(f: Updater[Binding]): Option[Schema[A]]
Implicitly added by indexedSeq

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def updated[B](optic: Optic[A, B])(f: Bound[B] => Bound[B]): Option[Schema[A]]
Implicitly added by indexedSeq

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala
def updated(dynamic: DynamicOptic)(f: Updater[Binding]): Option[Schema[A]]
Implicitly added by list

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def updated[B](optic: Optic[A, B])(f: Bound[B] => Bound[B]): Option[Schema[A]]
Implicitly added by list

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala
def updated(dynamic: DynamicOptic)(f: Updater[Binding]): Option[Schema[A]]
Implicitly added by maybe

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def updated[B](optic: Optic[A, B])(f: Bound[B] => Bound[B]): Option[Schema[A]]
Implicitly added by maybe

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala
def updated(dynamic: DynamicOptic)(f: Updater[Binding]): Option[Schema[A]]
Implicitly added by option

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def updated[B](optic: Optic[A, B])(f: Bound[B] => Bound[B]): Option[Schema[A]]
Implicitly added by option

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala
def updated(dynamic: DynamicOptic)(f: Updater[Binding]): Option[Schema[A]]
Implicitly added by seq

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def updated[B](optic: Optic[A, B])(f: Bound[B] => Bound[B]): Option[Schema[A]]
Implicitly added by seq

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala
def updated(dynamic: DynamicOptic)(f: Updater[Binding]): Option[Schema[A]]
Implicitly added by set

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def updated[B](optic: Optic[A, B])(f: Bound[B] => Bound[B]): Option[Schema[A]]
Implicitly added by set

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala
def updated(dynamic: DynamicOptic)(f: Updater[Binding]): Option[Schema[A]]
Implicitly added by vector

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def updated[B](optic: Optic[A, B])(f: Bound[B] => Bound[B]): Option[Schema[A]]
Implicitly added by vector

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala
def updated(dynamic: DynamicOptic)(f: Updater[Binding]): Option[Schema[A]]

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Returns a schema in which f has rewritten the part of A at the path dynamic, or None when the path does not resolve against this schema.

Attributes

Source
Schema.scala
def updated[B](optic: Optic[A, B])(f: Bound[B] => Bound[B]): Option[Schema[A]]

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Returns a schema in which f has rewritten the part of A that optic focuses on, or None when the optic does not resolve against this schema.

Attributes

Source
Schema.scala

Inherited methods

def productElementNames: Iterator[String]
Implicitly added by chunk

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
def productElementNames: Iterator[String]
Implicitly added by indexedSeq

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
def productElementNames: Iterator[String]
Implicitly added by list

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
def productElementNames: Iterator[String]
Implicitly added by maybe

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
def productElementNames: Iterator[String]
Implicitly added by option

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
def productElementNames: Iterator[String]
Implicitly added by seq

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
def productElementNames: Iterator[String]
Implicitly added by set

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
def productElementNames: Iterator[String]
Implicitly added by vector

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
def productElementNames: Iterator[String]

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
def productIterator: Iterator[Any]
Implicitly added by chunk

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 productIterator: Iterator[Any]
Implicitly added by indexedSeq

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 productIterator: Iterator[Any]
Implicitly added by list

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 productIterator: Iterator[Any]
Implicitly added by maybe

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 productIterator: Iterator[Any]
Implicitly added by option

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 productIterator: Iterator[Any]
Implicitly added by seq

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 productIterator: Iterator[Any]
Implicitly added by set

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 productIterator: Iterator[Any]
Implicitly added by vector

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 productIterator: Iterator[Any]

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
transparent inline def structural(using ts: ToStructural[A]): Schema[ts.StructuralType]
Implicitly added by chunk

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

On Scala 3 the result has the structural type. On Scala 2 its static type is Schema[ts.StructuralType]: the compiler does not see the refinement, so the result cannot be assigned to a Schema of the structural type.

The conversion is available on the JVM only, because structural types need reflection.

case class Book(title: String, year: Int)

val structural = Schema.derived[Book].structural

Value parameters

ts

the macro-generated conversion to the structural type

Attributes

See also
Inherited from:
SchemaVersionSpecific
Source
SchemaVersionSpecific.scala
transparent inline def structural(using ts: ToStructural[A]): Schema[ts.StructuralType]
Implicitly added by indexedSeq

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

On Scala 3 the result has the structural type. On Scala 2 its static type is Schema[ts.StructuralType]: the compiler does not see the refinement, so the result cannot be assigned to a Schema of the structural type.

The conversion is available on the JVM only, because structural types need reflection.

case class Book(title: String, year: Int)

val structural = Schema.derived[Book].structural

Value parameters

ts

the macro-generated conversion to the structural type

Attributes

See also
Inherited from:
SchemaVersionSpecific
Source
SchemaVersionSpecific.scala
transparent inline def structural(using ts: ToStructural[A]): Schema[ts.StructuralType]
Implicitly added by list

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

On Scala 3 the result has the structural type. On Scala 2 its static type is Schema[ts.StructuralType]: the compiler does not see the refinement, so the result cannot be assigned to a Schema of the structural type.

The conversion is available on the JVM only, because structural types need reflection.

case class Book(title: String, year: Int)

val structural = Schema.derived[Book].structural

Value parameters

ts

the macro-generated conversion to the structural type

Attributes

See also
Inherited from:
SchemaVersionSpecific
Source
SchemaVersionSpecific.scala
transparent inline def structural(using ts: ToStructural[A]): Schema[ts.StructuralType]
Implicitly added by maybe

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

On Scala 3 the result has the structural type. On Scala 2 its static type is Schema[ts.StructuralType]: the compiler does not see the refinement, so the result cannot be assigned to a Schema of the structural type.

The conversion is available on the JVM only, because structural types need reflection.

case class Book(title: String, year: Int)

val structural = Schema.derived[Book].structural

Value parameters

ts

the macro-generated conversion to the structural type

Attributes

See also
Inherited from:
SchemaVersionSpecific
Source
SchemaVersionSpecific.scala
transparent inline def structural(using ts: ToStructural[A]): Schema[ts.StructuralType]
Implicitly added by option

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

On Scala 3 the result has the structural type. On Scala 2 its static type is Schema[ts.StructuralType]: the compiler does not see the refinement, so the result cannot be assigned to a Schema of the structural type.

The conversion is available on the JVM only, because structural types need reflection.

case class Book(title: String, year: Int)

val structural = Schema.derived[Book].structural

Value parameters

ts

the macro-generated conversion to the structural type

Attributes

See also
Inherited from:
SchemaVersionSpecific
Source
SchemaVersionSpecific.scala
transparent inline def structural(using ts: ToStructural[A]): Schema[ts.StructuralType]
Implicitly added by seq

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

On Scala 3 the result has the structural type. On Scala 2 its static type is Schema[ts.StructuralType]: the compiler does not see the refinement, so the result cannot be assigned to a Schema of the structural type.

The conversion is available on the JVM only, because structural types need reflection.

case class Book(title: String, year: Int)

val structural = Schema.derived[Book].structural

Value parameters

ts

the macro-generated conversion to the structural type

Attributes

See also
Inherited from:
SchemaVersionSpecific
Source
SchemaVersionSpecific.scala
transparent inline def structural(using ts: ToStructural[A]): Schema[ts.StructuralType]
Implicitly added by set

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

On Scala 3 the result has the structural type. On Scala 2 its static type is Schema[ts.StructuralType]: the compiler does not see the refinement, so the result cannot be assigned to a Schema of the structural type.

The conversion is available on the JVM only, because structural types need reflection.

case class Book(title: String, year: Int)

val structural = Schema.derived[Book].structural

Value parameters

ts

the macro-generated conversion to the structural type

Attributes

See also
Inherited from:
SchemaVersionSpecific
Source
SchemaVersionSpecific.scala
transparent inline def structural(using ts: ToStructural[A]): Schema[ts.StructuralType]
Implicitly added by vector

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

On Scala 3 the result has the structural type. On Scala 2 its static type is Schema[ts.StructuralType]: the compiler does not see the refinement, so the result cannot be assigned to a Schema of the structural type.

The conversion is available on the JVM only, because structural types need reflection.

case class Book(title: String, year: Int)

val structural = Schema.derived[Book].structural

Value parameters

ts

the macro-generated conversion to the structural type

Attributes

See also
Inherited from:
SchemaVersionSpecific
Source
SchemaVersionSpecific.scala
transparent inline def structural(using ts: ToStructural[A]): Schema[ts.StructuralType]

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

Converts this schema to a schema of the structural type of A: a refinement with one member per field, such as { def title: String; def year: Int } for case class Book(title: String, year: Int). Use it to work with values by their shape rather than by their nominal type.

On Scala 3 the result has the structural type. On Scala 2 its static type is Schema[ts.StructuralType]: the compiler does not see the refinement, so the result cannot be assigned to a Schema of the structural type.

The conversion is available on the JVM only, because structural types need reflection.

case class Book(title: String, year: Int)

val structural = Schema.derived[Book].structural

Value parameters

ts

the macro-generated conversion to the structural type

Attributes

See also
Inherited from:
SchemaVersionSpecific
Source
SchemaVersionSpecific.scala

Concrete fields

lazy val jsonCodec: JsonCodec[A]
Implicitly added by chunk

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

Derivation reads only the schema, so this codec ignores an implicit JsonCodec in scope and the overrides of a configured deriver, such as JsonCodecDeriver.withInstance. To use a configured deriver, derive the codec with derive or deriving and call that codec directly: the toJsonString and fromJson syntax always uses this one.

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val json = Book.schema.jsonCodec.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","year":2021}
val book = Book.schema.jsonCodec.decode("""{"title":"Zionomicon","year":2021}""")
// Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala
lazy val jsonCodec: JsonCodec[A]
Implicitly added by indexedSeq

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

Derivation reads only the schema, so this codec ignores an implicit JsonCodec in scope and the overrides of a configured deriver, such as JsonCodecDeriver.withInstance. To use a configured deriver, derive the codec with derive or deriving and call that codec directly: the toJsonString and fromJson syntax always uses this one.

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val json = Book.schema.jsonCodec.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","year":2021}
val book = Book.schema.jsonCodec.decode("""{"title":"Zionomicon","year":2021}""")
// Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala
lazy val jsonCodec: JsonCodec[A]
Implicitly added by list

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

Derivation reads only the schema, so this codec ignores an implicit JsonCodec in scope and the overrides of a configured deriver, such as JsonCodecDeriver.withInstance. To use a configured deriver, derive the codec with derive or deriving and call that codec directly: the toJsonString and fromJson syntax always uses this one.

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val json = Book.schema.jsonCodec.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","year":2021}
val book = Book.schema.jsonCodec.decode("""{"title":"Zionomicon","year":2021}""")
// Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala
lazy val jsonCodec: JsonCodec[A]
Implicitly added by maybe

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

Derivation reads only the schema, so this codec ignores an implicit JsonCodec in scope and the overrides of a configured deriver, such as JsonCodecDeriver.withInstance. To use a configured deriver, derive the codec with derive or deriving and call that codec directly: the toJsonString and fromJson syntax always uses this one.

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val json = Book.schema.jsonCodec.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","year":2021}
val book = Book.schema.jsonCodec.decode("""{"title":"Zionomicon","year":2021}""")
// Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala
lazy val jsonCodec: JsonCodec[A]
Implicitly added by option

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

Derivation reads only the schema, so this codec ignores an implicit JsonCodec in scope and the overrides of a configured deriver, such as JsonCodecDeriver.withInstance. To use a configured deriver, derive the codec with derive or deriving and call that codec directly: the toJsonString and fromJson syntax always uses this one.

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val json = Book.schema.jsonCodec.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","year":2021}
val book = Book.schema.jsonCodec.decode("""{"title":"Zionomicon","year":2021}""")
// Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala
lazy val jsonCodec: JsonCodec[A]
Implicitly added by seq

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

Derivation reads only the schema, so this codec ignores an implicit JsonCodec in scope and the overrides of a configured deriver, such as JsonCodecDeriver.withInstance. To use a configured deriver, derive the codec with derive or deriving and call that codec directly: the toJsonString and fromJson syntax always uses this one.

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val json = Book.schema.jsonCodec.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","year":2021}
val book = Book.schema.jsonCodec.decode("""{"title":"Zionomicon","year":2021}""")
// Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala
lazy val jsonCodec: JsonCodec[A]
Implicitly added by set

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

Derivation reads only the schema, so this codec ignores an implicit JsonCodec in scope and the overrides of a configured deriver, such as JsonCodecDeriver.withInstance. To use a configured deriver, derive the codec with derive or deriving and call that codec directly: the toJsonString and fromJson syntax always uses this one.

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val json = Book.schema.jsonCodec.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","year":2021}
val book = Book.schema.jsonCodec.decode("""{"title":"Zionomicon","year":2021}""")
// Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala
lazy val jsonCodec: JsonCodec[A]
Implicitly added by vector

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

Derivation reads only the schema, so this codec ignores an implicit JsonCodec in scope and the overrides of a configured deriver, such as JsonCodecDeriver.withInstance. To use a configured deriver, derive the codec with derive or deriving and call that codec directly: the toJsonString and fromJson syntax always uses this one.

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val json = Book.schema.jsonCodec.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","year":2021}
val book = Book.schema.jsonCodec.decode("""{"title":"Zionomicon","year":2021}""")
// Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala
lazy val jsonCodec: JsonCodec[A]

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

The JSON codec of A, derived on first use with the default JSON deriver and cached. It is the instance that getInstance(JsonFormat) returns.

Derivation reads only the schema, so this codec ignores an implicit JsonCodec in scope and the overrides of a configured deriver, such as JsonCodecDeriver.withInstance. To use a configured deriver, derive the codec with derive or deriving and call that codec directly: the toJsonString and fromJson syntax always uses this one.

case class Book(title: String, year: Int)
object Book {
 implicit val schema: Schema[Book] = Schema.derived
}

val json = Book.schema.jsonCodec.encodeToString(Book("Zionomicon", 2021))
// {"title":"Zionomicon","year":2021}
val book = Book.schema.jsonCodec.decode("""{"title":"Zionomicon","year":2021}""")
// Right(Book(Zionomicon,2021))

Attributes

See also
Source
Schema.scala