Attributes
- Companion
- trait
- Source
- DiscriminatorKind.scala
- Graph
-
- Supertypes
- Self type
-
DiscriminatorKind.type
Members list
Type members
Classlikes
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.
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
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait DiscriminatorKindclass Objecttrait Matchableclass AnyShow all
Represents a discriminator strategy where the subtype identifier is encoded as the key of a TOON record.
Represents a discriminator strategy where the subtype identifier is encoded as the key of a TOON record.
It is a default strategy for serializing and deserializing of all kinds of variants (sealed hierarchies, union types, etc.).
In this strategy, the serialized representation of the subtype wraps the encoded value in a nested record keyed by the subtype's discriminator, e.g., SubtypeIdentifier: followed by indented fields.
This approach enables subtype differentiation based solely on the key of the TOON record for the sealed hierarchy.
Attributes
- Source
- DiscriminatorKind.scala
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait DiscriminatorKindclass Objecttrait Matchableclass AnyShow all
- Self type
-
Key.type
Represents the absence of a discriminator strategy for serializing and deserializing sealed hierarchy subtypes or union types.
Represents the absence of a discriminator strategy for serializing and deserializing sealed hierarchy subtypes or union types.
When this strategy is used, subtype differentiation is performed without adding any explicit discriminator field or key to the serialized TOON. Instead, deserialization attempts to match the input TOON data sequentially against all possible subtypes of the sealed hierarchy until a successful match is found.
This approach relies on the order and structure of subtype definitions and may result in parsing errors if no matching subtype is found.
Beware that this strategy hides error messages of underlying parsing errors and parsing be too slow for large hierarchies of subtypes or deeply nested or recursive data structures.
Don't use it for untrusted input that should be parsed into deeply nested or recursive data structures to avoid potential security vulnerabilities of DoS/DoW attacks.
Attributes
- Source
- DiscriminatorKind.scala
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait DiscriminatorKindclass Objecttrait Matchableclass AnyShow all
- Self type
-
None.type
Inherited and Abstract types
The names of the product elements.
The name of the type.