Field

zio.blocks.schema.toon.DiscriminatorKind.Field
case class Field(name: String) extends DiscriminatorKind

Represents a discriminator strategy where a specific field in the TOON record is used to identify the subtype of a sealed hierarchy, e.g. $type: SubtypeIdentifier followed by the record fields.

Can be used only for serializing sealed hierarchy subtypes of non-abstract classes only (not union types).

Beware that parsing may be too slow for deeply nested or recursive data structures when the discriminator field is placed at the end of the TOON record.

Don't use it for untrusted input that should be parsed to deeply nested or recursive data structures to avoid potential security vulnerabilities of DoS/DoW attacks.

Value parameters

name

The name of the discriminator field to be added to the TOON record. This field value will contain the subtype identifier as its value.

Attributes

Source
DiscriminatorKind.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

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]

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