atproto_codegen/emit/union
Union synthesis with $type-dispatching codecs. Open unions get an
Other(Dynamic) escape hatch; closed unions fail decode instead.
The three parts (type, encoder, decoder) are returned separately rather
than as one joined string: the types plugin renders the first two, the
decode-json plugin the third, and the host interleaves them with the
def’s own type/encoder/decoder so the emitted file matches the order the
monolithic emitter used to produce.
Types
pub type UnionParts {
UnionParts(type_def: String, encoder: String, decoder: String)
}
Constructors
-
UnionParts(type_def: String, encoder: String, decoder: String)
Values
pub fn emit_union(
plan: zero.ZeroPlan,
cfg: config.Config,
nsid: String,
name: String,
refs: List(String),
closed: Bool,
) -> UnionParts