zio.blocks.schema.toon.DiscriminatorKind
See theDiscriminatorKind companion object
Represents the strategy for specifying the discriminator used in a TOON schema for distinguishing between different subtypes of a sealed hierarchy.
Implementations of this trait define how the discriminator is represented in the serialized TOON, if any.
The possible discriminator kinds include:
Fieldwith adding a custom field named as specified in thenameparameter that contains a value of the subtype discriminator, e.g.type: Personfollowed by the record fields forcase class Person(...) extends SealedTraitKey, where the discriminator is represented as a TOON key with wrapping of the encoded value in a nested record, e.g.Person:followed by indented fields forcase class Person(...) extends SealedTrait.None, where no discriminator is used, meaning subtype differentiation is handled by sequential attempts to parse all possible subtypes, starting from the first subtype, until a successful parse is found, or an error is thrown if none of the subtypes can be parsed from the input.
Attributes
- Companion
- object
- Source
- DiscriminatorKind.scala
- Graph
-
- Supertypes
- Known subtypes
In this article