Modifier

zio.blocks.schema.Modifier
See theModifier companion trait
object Modifier

The built-in modifiers and their schemas.

Attributes

Companion
trait
Source
Modifier.scala
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Modifier.type

Members list

Type members

Classlikes

sealed trait Reflect extends Modifier

Modifiers of a type, that is, of a schema node: config, discriminator, noExtraFields, fieldNaming and caseNaming.

Modifiers of a type, that is, of a schema node: config, discriminator, noExtraFields, fieldNaming and caseNaming.

Attributes

Source
Modifier.scala
Supertypes
trait Modifier
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
Known subtypes
class caseNaming
class config
class fieldNaming
sealed trait Term extends Modifier

Modifiers of a record field or a variant case: transient, encodeTransient, rename, alias, id and config.

Modifiers of a record field or a variant case: transient, encodeTransient, rename, alias, id and config.

Attributes

Source
Modifier.scala
Supertypes
trait Modifier
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
Known subtypes
class alias
class config
class id
class rename
class transient
Show all
case class alias(name: String) extends Term

Makes the JSON codec also accept name for a field or a case when decoding. Encoding still uses the main name: the rename name, or the Scala name after any naming strategy. A field or case can have several aliases.

Makes the JSON codec also accept name for a field or a case when decoding. Encoding still uses the main name: the rename name, or the Scala name after any naming strategy. A field or case can have several aliases.

Attributes

Source
Modifier.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Term
trait Modifier
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
case class caseNaming(strategy: String) extends Reflect

Makes the JSON codec of a variant map its case names with the naming strategy strategy, one of the values that fieldNaming accepts. A case with a rename keeps that name.

Makes the JSON codec of a variant map its case names with the naming strategy strategy, one of the values that fieldNaming accepts. A case with a rename keeps that name.

Attributes

Source
Modifier.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Reflect
trait Modifier
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
case class config(key: String, value: String) extends Term, Reflect

A configuration key-value pair, which can be attached to any type of reflect values. The convention for keys is .. For example, protobuf.field-id is a key that specifies the field id for a protobuf format.

A configuration key-value pair, which can be attached to any type of reflect values. The convention for keys is .. For example, protobuf.field-id is a key that specifies the field id for a protobuf format.

Attributes

Source
Modifier.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Reflect
trait Term
trait Modifier
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
case class discriminator(name: String) extends Reflect

Makes the JSON codec of a variant write the case name in the field name of the case's object, as in {"type":"Hardcover"}, instead of wrapping the case in an object keyed by its name. It takes precedence over the discriminator setting of the deriver.

Makes the JSON codec of a variant write the case name in the field name of the case's object, as in {"type":"Hardcover"}, instead of wrapping the case in an object keyed by its name. It takes precedence over the discriminator setting of the deriver.

Attributes

Source
Modifier.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Reflect
trait Modifier
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
case class encodeTransient() extends Term

Leaves a field out when the JSON codec encodes, but still reads it when it decodes. Like transient, it needs a default value unless the field is an Option or a collection.

Leaves a field out when the JSON codec encodes, but still reads it when it decodes. Like transient, it needs a default value unless the field is an Option or a collection.

Attributes

Source
Modifier.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Term
trait Modifier
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
case class fieldNaming(strategy: String) extends Reflect

Makes the JSON codec of a record map its field names with the naming strategy strategy: identity, snake_case, camelCase, kebab-case or PascalCase. Another value makes the derivation of the codec throw an IllegalArgumentException. A field with a rename keeps that name.

Makes the JSON codec of a record map its field names with the naming strategy strategy: identity, snake_case, camelCase, kebab-case or PascalCase. Another value makes the derivation of the codec throw an IllegalArgumentException. A field with a rename keeps that name.

Attributes

Source
Modifier.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Reflect
trait Modifier
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
case class id() extends Term

A modifier that explicitly marks a term as the primary key field. Used by Repo.derived to resolve ambiguity when multiple fields share the same type or when auto-detection would be inconclusive.

A modifier that explicitly marks a term as the primary key field. Used by Repo.derived to resolve ambiguity when multiple fields share the same type or when auto-detection would be inconclusive.

Attributes

Source
Modifier.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Term
trait Modifier
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
case class noExtraFields() extends Reflect

Makes the JSON codec of a record reject keys that match no field, as JsonCodecDeriver.withRejectExtraFields(true) does for every record.

Makes the JSON codec of a record reject keys that match no field, as JsonCodecDeriver.withRejectExtraFields(true) does for every record.

Attributes

Source
Modifier.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Reflect
trait Modifier
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
case class rename(name: String) extends Term

Makes the JSON codec use name for a field or a case instead of its Scala name, both when encoding and when decoding: the Scala name is no longer accepted, so add an alias to accept it too. It takes precedence over fieldNaming and caseNaming.

Makes the JSON codec use name for a field or a case instead of its Scala name, both when encoding and when decoding: the Scala name is no longer accepted, so add an alias to accept it too. It takes precedence over fieldNaming and caseNaming.

Attributes

Source
Modifier.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Term
trait Modifier
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
case class transient() extends Term

Makes the JSON codec leave a field out when it encodes. The TOON and BSON codecs also read it; the Avro, MessagePack, Thrift, CSV, XML and YAML codecs ignore it. When the JSON codec decodes, it treats the field's key like an unknown key (skipped, or rejected when extra fields are rejected), and the field gets its default value.

Makes the JSON codec leave a field out when it encodes. The TOON and BSON codecs also read it; the Avro, MessagePack, Thrift, CSV, XML and YAML codecs ignore it. When the JSON codec decodes, it treats the field's key like an unknown key (skipped, or rejected when extra fields are rejected), and the field gets its default value.

The field needs a default value unless it is an Option or a collection; otherwise Schema.derived fails to compile.

Attributes

Source
Modifier.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Term
trait Modifier
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Mirror
Source
Mirror.scala
type MirroredLabel <: String

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror
Source
Mirror.scala

Implicits

Implicits

implicit lazy val aliasSchema: Schema[alias]

The schema of alias.

The schema of alias.

Attributes

Source
Modifier.scala
implicit lazy val caseNamingSchema: Schema[caseNaming]

The schema of caseNaming.

The schema of caseNaming.

Attributes

Source
Modifier.scala
implicit lazy val configSchema: Schema[config]

The schema of config.

The schema of config.

Attributes

Source
Modifier.scala

The schema of discriminator.

The schema of discriminator.

Attributes

Source
Modifier.scala

The schema of encodeTransient.

The schema of encodeTransient.

Attributes

Source
Modifier.scala
implicit lazy val fieldNamingSchema: Schema[fieldNaming]

The schema of fieldNaming.

The schema of fieldNaming.

Attributes

Source
Modifier.scala
implicit lazy val idSchema: Schema[id]

The schema of id.

The schema of id.

Attributes

Source
Modifier.scala

The schema of noExtraFields.

The schema of noExtraFields.

Attributes

Source
Modifier.scala
implicit lazy val reflectSchema: Schema[Reflect]

The schema of Modifier.Reflect, a variant of the type modifiers.

The schema of Modifier.Reflect, a variant of the type modifiers.

Attributes

Source
Modifier.scala
implicit lazy val renameSchema: Schema[rename]

The schema of rename.

The schema of rename.

Attributes

Source
Modifier.scala
implicit lazy val schema: Schema[Modifier]

The schema of Modifier, a variant of all built-in modifiers.

The schema of Modifier, a variant of all built-in modifiers.

Attributes

Source
Modifier.scala
implicit lazy val termSchema: Schema[Term]

The schema of Modifier.Term, a variant of the term modifiers.

The schema of Modifier.Term, a variant of the term modifiers.

Attributes

Source
Modifier.scala
implicit lazy val transientSchema: Schema[transient]

The schema of transient.

The schema of transient.

Attributes

Source
Modifier.scala