Skip to main content

Module parsers

Module parsers 

Source
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 group arm’s leaf fields into an object literal matching its synthesized interface: { leaf1: <read>, leaf2: <read> }.
emit_inner_variant_read πŸ”’
Convenience wrapper using _inner as 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.