jsonDiscriminator

zio.json.jsonDiscriminator
final case class jsonDiscriminator(name: String) extends Annotation

If used on a sealed class, will determine the name of the field for disambiguating classes.

The default is to not use a typehint field and instead have an object with a single key that is the class name.

Note that using a discriminator is less performant, uses more memory, and may be prone to DOS attacks that are impossible with the default encoding. In addition, there is slightly less type safety when using custom product encoders (which must write an unenforced object type). Only use this option if you must model an externally defined schema.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Annotation
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product