vigoo/openapi_to_moonbit/ir does not have a README file

    IrVisitor

    pub(open) trait IrVisitor {
    fn visit_type(Self, TypeDef) -> Unit = _
    fn visit_field(Self, String, FieldIR) -> Unit = _
    fn visit_operation(Self, OpIR) -> Unit = _
    fn visit_param(Self, String, ParamIR) -> Unit = _
    }

    Read-only visitor over every type, record field, operation, and parameter in an IrModel.

    AliasDef

    pub(all) struct AliasDef {
    name : String
    target : FieldType
    docs : Array[String]
    example :
    Node
    ?
    deprecated : Bool
    source : String
    } derive(Eq,
    Debug
    )

    Alias definition payload.

    ApiChange

    pub(all) struct ApiChange {
    severity : ChangeSeverity
    kind : String
    target : String
    message : String
    } derive(Eq,
    Debug
    )

    A single classified change detected between two IrModel snapshots.

    ApiDiff

    pub(all) struct ApiDiff {
    changes : Array[ApiChange]
    } derive(Eq,
    Debug
    )

    Full API-surface comparison result produced by diff_ir.

    ApiDiff::breaking

    fn ApiDiff::breaking(self : ApiDiff) -> Array[ApiChange]

    Return only Breaking changes.

    ApiDiff::has_breaking

    fn ApiDiff::has_breaking(self : ApiDiff) -> Bool

    True when at least one Breaking change was detected.

    ApiDiff::is_empty

    fn ApiDiff::is_empty(self : ApiDiff) -> Bool

    True when no API changes were detected.

    ApiDiff::non_breaking

    fn ApiDiff::non_breaking(self : ApiDiff) -> Array[ApiChange]

    Return only NonBreaking changes.

    ApiDiff::render_text

    fn ApiDiff::render_text(self : ApiDiff) -> String

    Format the diff as a human-readable summary report.

    ApiDiff::to_json

    Serialize the diff as a structured JSON object (breaking, non_breaking, changes).

    BodyIR

    pub(all) enum BodyIR {
    Json(FieldType, content_type~ : String, required~ : Bool, docs~ : Array[String])
    Multipart(Array[MultipartPartIR], required~ : Bool, docs~ : Array[String])
    FormUrlEncoded(Array[MultipartPartIR], required~ : Bool, docs~ : Array[String])
    Text(content_type~ : String, required~ : Bool, docs~ : Array[String])
    Binary(content_type~ : String, required~ : Bool, docs~ : Array[String])
    NoBody
    } derive(Eq,
    Debug
    )

    ChangeSeverity

    pub(all) enum ChangeSeverity {
    Breaking
    NonBreaking
    } derive(Eq,
    Debug
    )

    Classification of an API surface change between two OpenAPI specs.

    FieldIR

    pub(all) struct FieldIR {
    name : String
    wire : String
    type_ : FieldType
    presence : Presence
    default :
    Node
    ?
    example :
    Node
    ?
    deprecated : Bool
    read_only : Bool
    write_only : Bool
    constraints :
    SchemaConstraints

    docs : Array[String]
    } derive(Eq,
    Debug
    )

    FieldType

    pub(all) enum FieldType {
    Prim(Prim)
    Named(String)
    List(FieldType)
    MapTo(FieldType)
    Optional(FieldType)
    JsonValue
    } derive(Eq,
    Debug
    )

    A type expression in the IR. FieldIR.type_ and ParamIR.type_ store the unwrapped base type while Presence records optionality/nullability; Optional(...) is used in standalone type positions such as AliasDef or List(Optional(T)).

    HeaderIR

    pub(all) struct HeaderIR {
    wire : String
    name : String
    type_ : FieldType
    style :
    ParameterStyle

    explode : Bool
    required : Bool
    deprecated : Bool
    docs : Array[String]
    } derive(Eq,
    Debug
    )

    InfoIR

    pub(all) struct InfoIR {
    title : String
    version : String
    description : String?
    } derive(Eq,
    Debug
    )

    Lowered top-level OpenAPI document metadata exposed on IrModel.

    IrHooks

    pub(all) struct IrHooks {
    map_def : (TypeDef) -> TypeDef??
    map_field : (String, FieldIR) -> FieldIR??
    map_operation : (OpIR) -> OpIR??
    }

    Closure-based IR transformation hooks for library consumers. Returning None from a hook filters out the item; returning Some(x) replaces it.

    IrHooks::empty

    fn IrHooks::empty() -> IrHooks

    No-op IrHooks with all hook callbacks unset.

    IrModel

    pub struct IrModel {
    // private fields
    }

    The immutable semantic IR produced by build_ir: ordered type registry, operations, tag groups, component accounting, document metadata, and diagnostics.

    IrModel::accounting

    fn IrModel::accounting(self : IrModel) -> Array[(String, String)]

    Accounting log mapping source component names to lowered MoonBit names or dispositions.

    IrModel::component_name

    fn IrModel::component_name(self : IrModel, component : String) -> String?

    The MoonBit name a component maps to, if defined/folded.

    IrModel::def

    fn IrModel::def(self : IrModel, name : String) -> TypeDef?

    Look up a definition by MoonBit name.

    IrModel::defs

    fn IrModel::defs(self : IrModel) -> Array[TypeDef]

    All lowered type definitions in deterministic emission order.

    IrModel::diags

    Diagnostics accumulated during spec loading and IR lowering.

    IrModel::groups

    fn IrModel::groups(self : IrModel) -> Array[(String, Array[String])]

    Operation groups as (group_name, operation_ids) pairs.

    IrModel::info

    fn IrModel::info(self : IrModel) -> InfoIR

    Document title, version, and optional description.

    IrModel::operations

    fn IrModel::operations(self : IrModel) -> Array[OpIR]

    All lowered HTTP and WebSocket operations.

    IrModel::security_schemes

    fn IrModel::security_schemes(self : IrModel) -> Array[SecuritySchemeIR]

    Top-level OpenAPI components.securitySchemes entries.

    IrModel::servers

    fn IrModel::servers(self : IrModel) -> Array[ServerIR]

    Top-level OpenAPI servers entries.

    IrModel::summary

    fn IrModel::summary(self : IrModel) -> String

    Full deterministic summary: counts, types in discovery order, operations in document order, groups, and component accounting.

    IrModel::tags

    fn IrModel::tags(self : IrModel) -> Array[TagIR]

    Top-level OpenAPI tags entries.

    IrModel::transform

    fn IrModel::transform(self : IrModel, hooks : IrHooks) -> IrModel

    Produce a new IrModel by applying hooks while preserving all internal indexes (types map, component_names, Named(...) references on rename, and tag groups).

    IrModel::walk

    fn[V : IrVisitor] IrModel::walk(self : IrModel, visitor : V) -> Unit

    Walk every definition, field, operation, and parameter in deterministic order, invoking visitor.

    IrOptions

    pub(all) struct IrOptions {
    open_string_enums : Bool
    open_tagged_unions : Bool
    global_tags : Array[String]
    } derive(Eq,
    Debug
    )

    IR lowering options controlling open-enum/union fallbacks and tag grouping.

    IrOptions::default

    fn IrOptions::default() -> IrOptions

    Default options: closed enums, no hardcoded global tags.

    MultipartPartIR

    pub(all) struct MultipartPartIR {
    wire : String
    name : String
    type_ : FieldType
    required : Bool
    is_binary : Bool
    content_type : String?
    docs : Array[String]
    } derive(Eq,
    Debug
    )

    A multipart part (form-data field): binary file parts (format: binary) vs JSON/scalar parts.

    OpIR

    pub(all) struct OpIR {
    operation_id : String
    method_name : String
    http_method :
    HttpMethod

    path : String
    group : String
    tags : Array[String]
    summary : String?
    description : String?
    deprecated : Bool
    params : Array[ParamIR]
    body : BodyIR
    responses : Array[ResponseIR]
    security : Array[
    SecurityAlternative
    ]
    servers : Array[ServerIR]
    docs : Array[String]
    } derive(Eq,
    Debug
    )

    Lowered API operation (HTTP endpoint or WebSocket upgrade) ready for code generation.

    Presence

    pub(all) enum Presence {
    Required
    RequiredNullable
    Optional
    OptionalNullable
    } derive(Eq,
    Debug
    )

    Four-state field/parameter presence:
    • Required: must be present and non-null (T)
    • RequiredNullable: must be present, may be JSON null (T? by default)
    • Optional: may be absent, non-null when present (T?)
    • OptionalNullable: may be absent or JSON null (T? by default; tri-state in tri-state mode)

    Presence::allows_null

    fn Presence::allows_null(self : Presence) -> Bool

    True when JSON null is valid for this field.

    Presence::is_optional

    fn Presence::is_optional(self : Presence) -> Bool

    True when the field maps to T? in default (non-tri-state) codegen.

    Presence::is_required

    fn Presence::is_required(self : Presence) -> Bool

    True when the property/parameter MUST be present on the wire (Required or RequiredNullable).

    Prim

    pub(all) enum Prim {
    Str(String)
    Int(String)
    Num(String)
    Bool
    } derive(Eq,
    Debug
    )

    Primitive leaf types, carrying the OAS format that produced them (empty string = no format).

    RecordDef

    pub(all) struct RecordDef {
    name : String
    fields : Array[FieldIR]
    docs : Array[String]
    example :
    Node
    ?
    deprecated : Bool
    source : String
    } derive(Eq,
    Debug
    )

    Record definition payload.

    ResponseBodyKind

    pub(all) enum ResponseBodyKind {
    Empty
    Json(FieldType)
    Binary
    Text
    Stream(StreamKind)
    Other(FieldType?)
    } derive(Eq,
    Debug
    )

    Normalized classification of a response payload independent of raw Content-Type syntax.

    ResponseIR

    pub(all) struct ResponseIR {
    status :
    StatusCode

    content_type : String
    body_kind : ResponseBodyKind
    type_ : FieldType?
    headers : Array[HeaderIR]
    docs : Array[String]
    } derive(Eq,
    Debug
    )

    Lowered HTTP or WebSocket response entry for a single status code or wildcard range.

    SecuritySchemeIR

    pub(all) struct SecuritySchemeIR {
    name : String
    type_ :
    SecuritySchemeType

    description : String?
    } derive(Eq,
    Debug
    )

    A lowered OpenAPI components.securitySchemes entry.

    ServerIR

    pub(all) struct ServerIR {
    url : String
    description : String?
    variables : Array[ServerVariableIR]
    } derive(Eq,
    Debug
    )

    A lowered OpenAPI server entry with its URL template and variables.

    ServerIR::default_url

    fn ServerIR::default_url(self : ServerIR) -> String

    Expand {var} templates in a single pass using each variable's default value (OAS §4.7.5 literal substitution, immune to chained placeholder expansion when a variable's value itself contains {other}).

    ServerVariableIR

    pub(all) struct ServerVariableIR {
    name : String
    default : String
    enum_ : Array[String]
    description : String?
    } derive(Eq,
    Debug
    )

    A single variable placeholder declared inside an OpenAPI server URL template.

    StreamKind

    pub(all) enum StreamKind {
    Sse
    Ndjson(FieldType)
    Binary
    } derive(Eq,
    Debug
    )

    Streaming response protocol kind.

    StringEnumDef

    pub(all) struct StringEnumDef {
    name : String
    variants : Array[StringEnumVariant]
    open : Bool
    unknown_variant : String?
    docs : Array[String]
    example :
    Node
    ?
    deprecated : Bool
    source : String
    } derive(Eq,
    Debug
    )

    String-enum definition payload.

    StringEnumVariant

    pub(all) struct StringEnumVariant {
    name : String
    wire : String
    } derive(Eq,
    Debug
    )

    One variant of a string enum (pre-computed MoonBit name + wire value).

    TagIR

    pub(all) struct TagIR {
    name : String
    description : String?
    } derive(Eq,
    Debug
    )

    A lowered top-level OpenAPI tag declaration.

    TaggedEnumDef

    pub(all) struct TaggedEnumDef {
    name : String
    tag_property : String
    variants : Array[VariantIR]
    open : Bool
    unknown_variant : String?
    docs : Array[String]
    example :
    Node
    ?
    deprecated : Bool
    source : String
    } derive(Eq,
    Debug
    )

    Tagged-union definition payload.

    TypeDef

    pub(all) enum TypeDef {
    Record(RecordDef)
    TaggedEnum(TaggedEnumDef)
    StringEnum(StringEnumDef)
    UntaggedEnum(UntaggedEnumDef)
    Alias(AliasDef)
    } derive(Eq,
    Debug
    )

    A named definition in the registry.

    TypeDef::name

    fn TypeDef::name(self : TypeDef) -> String

    The MoonBit-safe name of a definition.

    TypeDef::source

    fn TypeDef::source(self : TypeDef) -> String

    The source component/context name of a definition.

    UntaggedEnumDef

    pub(all) struct UntaggedEnumDef {
    name : String
    variants : Array[UntaggedVariantIR]
    docs : Array[String]
    example :
    Node
    ?
    deprecated : Bool
    source : String
    } derive(Eq,
    Debug
    )

    Shape-distinguishable untagged union (e.g. number | object).

    UntaggedVariantIR

    pub(all) struct UntaggedVariantIR {
    name : String
    type_ : FieldType
    } derive(Eq,
    Debug
    )

    One branch of a shape-distinguishable untagged structural union (e.g. number | {$float: ...}).

    VariantIR

    pub(all) struct VariantIR {
    name : String
    wire_tag : String
    payload : VariantPayload
    docs : Array[String]
    } derive(Eq,
    Debug
    )

    VariantPayload

    pub(all) enum VariantPayload {
    Unit
    NewType(FieldType)
    Fields(Array[FieldIR])
    } derive(Eq,
    Debug
    )

    A tagged-union variant payload.
    • Unit: tag property alone ({"type": "Get"})
    • NewType(T): internally flattened payload ({"type": "Key", ...T})
    • Fields(fs): inline sibling fields in the same object ({"tag": "other", "value": ...})

    build_ir

    Build the full semantic IR from a loaded OpenAPI spec.

    diff_ir

    fn diff_ir(old_ir : IrModel, new_ir : IrModel) -> ApiDiff

    Compare two IrModel snapshots and return all classified API-surface changes (Breaking vs NonBreaking).

    field_type_to_text

    fn field_type_to_text(field_type : FieldType) -> String

    Render a field type compactly.

    group_for

    fn group_for(tags : Array[String], tag_counts : Map[String, Int], global_tags? : Array[String]) -> String

    Choose the group for an operation: the non-global tag with the fewest operations overall (ties -> earliest in the operation's tag list); operations carrying only global tags land in the first global tag.

    op_to_text

    fn op_to_text(op : OpIR) -> String

    Compact operation line.

    type_def_to_text

    fn type_def_to_text(def : TypeDef) -> String

    One-line rendering of a definition.