Expand description
Generate TypeScript response parser functions.
For each service, generates a parse{Service}Response function that reads
the response union discriminant and returns typed data.
Scoped response variants (structs that themselves contain unions) are
parsed recursively, returning nested { variant, data } objects.
FunctionsΒ§
- emit_
group_ πarm_ read - Read an inline union
grouparmβs leaf fields into an object literal matching its synthesized interface:{ leaf1: <read>, leaf2: <read> }. - emit_
inner_ πvariant_ read - Convenience wrapper using
_inneras the reader variable (for scoped response parsing). - emit_
inner_ πvariant_ read_ from - Generate an inline expression to read an inner variantβs data.
- emit_
option_ πread_ expr - Generate an inline expression that reads an Option* wrapper struct pointer.
- emit_
pointer_ πread_ expr - Emit a read expression for a pointer-section field.
- emit_
reader_ πfield - emit_
return π - emit_
scoped_ πresponse_ parse - Emit code to parse a scoped response variant (inner union within a struct).
- emit_
struct_ πelement_ field_ read - Generate an inline read expression for a single struct field (thin wrapper).
- emit_
struct_ πelement_ field_ read_ inner - Generate an inline read expression for a single struct field. Handles data scalars, pointers (Text, Data, List(Text), List(Struct), Struct), and groups.
- emit_
struct_ πlist_ field_ expr - Generate an inline expression that reads a List(Struct) and maps elements to objects.
- emit_
struct_ πlist_ read - Emit a top-level List(Struct) variant read wrapped in a block.
- emit_
struct_ πpointer_ expr - Emit an inline IIFE that reads a struct pointer and returns an object literal.
- emit_
struct_ πread - emit_
union_ πstruct_ list_ field_ expr - Generate a multi-line expression for reading a List(UnionStruct).
- generate_
parsers - Generate response parser types and functions for a service.
- generate_
plain_ πstruct_ parser - Generate a parser function for a non-union struct.
- generate_
struct_ parsers - Generate standalone parser functions for all structs in a schema.