oaspec/codegen/ir_build

Values

pub fn build_request_types_module(
  ctx: context.Context,
) -> ir.Module

Build an IR Module for the request_types.gleam file from operations. Each operation with at least one parameter or a request body yields a single RecordType declaration. Operations with neither parameters nor body produce no declaration — matching the former string-builder behavior that simply skipped them.

pub fn build_response_types_module(
  ctx: context.Context,
) -> ir.Module

Build an IR Module for the response_types.gleam file from operations. Each operation with at least one response yields a UnionType declaration whose variants correspond to HTTP status codes. Variant payloads follow the same rules the former string-builder applied: empty responses become VariantEmpty; text/XML/octet-stream bodies become VariantWithType("String"); JSON (and other structured) bodies become VariantWithType(<qualified schema type>).

pub fn build_types_module(ctx: context.Context) -> ir.Module

Build an IR Module for the types.gleam file from component schemas.

pub fn is_internal_schema(schema_ref: schema.SchemaRef) -> Bool

Check if a schema ref is marked as internal (allOf helper type).

pub fn sorted_entries(
  d: dict.Dict(String, v),
) -> List(#(String, v))

Sort dict entries by key for deterministic output ordering. Gleam Dict does not guarantee iteration order, so all codegen paths that produce output from dict entries must sort first.

Search Document