alloy.Untagged
See theUntagged companion object
Implies a different encoding for unions where
different alternatives are not tagged. This union type
should be avoided whenever possible for performance
reasons. However, some third party APIs use it so it
is important to be able to represent it.
The following union:
structure One {
a: Int
}
structure Two {
b: String
}
union Test {
one: One
two: Two
}
would normally be encoded in JSON as
{ "one": { "a": 123 } }
When it is annotated with ``@untagged
, it is
instead encoded as:
{ "a": 123 }. Therefore the parser will need to try
each different alternative in the union before it can
determine which one is appropriate.
Attributes
- Companion:
- object
- Graph
- Supertypes