zio.blocks.schema.json.DiscriminatorKind
See theDiscriminatorKind companion object
Represents the strategy for specifying the discriminator used in a JSON schema for distinguishing between different subtypes of a sealed hierarchy.
Implementations of this trait define how the discriminator is represented in the serialized JSON, 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": "Person", ...}forcase class Person(...) extends SealedTraitKey, where the discriminator is represented as a JSON object key with wrapping of the encoded value in a JSON object, e.g.{"Person":{...}}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