vigoo/openapi_to_moonbit/spec does not have a README file

    SpecError

    pub(all) suberror SpecError {
    SpecError(String)
    } derive(Eq,
    Debug
    )

    Hard failure: the source cannot be parsed at all (the message includes line/column for YAML when the parser reported them).

    AdditionalProperties

    pub(all) enum AdditionalProperties {
    Allowed(Bool)
    Schema(RefOr[Schema])
    } derive(Eq,
    Debug
    )

    Components

    pub struct Components {
    schemas : Array[(String, RefOr[Schema])]
    security_schemes : Array[(String, RefOr[SecurityScheme])]
    parameters : Array[(String, RefOr[Parameter])]
    request_bodies : Array[(String, RefOr[RequestBody])]
    responses : Array[(String, RefOr[Response])]
    headers : Array[(String, RefOr[Header])]
    path_items : Array[(String, RefOr[PathItem])]
    other_sections : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    Diagnostic

    pub(all) struct Diagnostic {
    severity : Severity
    code : String
    pointer : String
    message : String
    } derive(Eq,
    Debug
    )

    A single diagnostic emitted during OpenAPI parsing, bundling, merging, or IR lowering.

    Diagnostics

    pub struct Diagnostics {
    mode : Mode
    // private fields
    } derive(Eq,
    Debug
    )

    Mutable diagnostic accumulator threaded through spec parsing and IR lowering.

    Diagnostics::copy_items

    fn Diagnostics::copy_items(self : Diagnostics) -> Array[Diagnostic]

    Return a defensive copy of all recorded diagnostics in emission order.

    Diagnostics::error

    fn Diagnostics::error(self : Diagnostics, code : String, pointer : String, message : String) -> Unit

    Record an Error-severity diagnostic at JSON pointer pointer.

    Diagnostics::has_errors

    fn Diagnostics::has_errors(self : Diagnostics) -> Bool

    True when any Error-severity diagnostic was recorded.

    Diagnostics::is_oas_31

    fn Diagnostics::is_oas_31(self : Diagnostics) -> Bool

    True when the loaded document is OpenAPI 3.1.

    Diagnostics::is_strict

    fn Diagnostics::is_strict(self : Diagnostics) -> Bool

    True when the collector is running in Strict mode.

    Diagnostics::length

    fn Diagnostics::length(self : Diagnostics) -> Int

    Diagnostics::messages

    fn Diagnostics::messages(self : Diagnostics) -> Array[String]

    Formatted messages (ERROR [code] /pointer: message), in order.

    Diagnostics::new

    fn Diagnostics::new(mode? : Mode) -> Diagnostics

    Create an empty diagnostic collector in mode (default Strict).

    Diagnostics::set_oas_31

    fn Diagnostics::set_oas_31(self : Diagnostics, enabled : Bool) -> Unit

    Record whether the loaded document declares OpenAPI 3.1.

    Diagnostics::unsupported

    fn Diagnostics::unsupported(self : Diagnostics, code : String, pointer : String, message : String) -> Unit

    An unsupported construct: Error in strict mode, Warning in lenient mode.

    Diagnostics::warning

    fn Diagnostics::warning(self : Diagnostics, code : String, pointer : String, message : String) -> Unit

    Record a Warning-severity diagnostic at JSON pointer pointer.

    Discriminator

    pub struct Discriminator {
    property_name : String
    mapping : Array[(String, String)]
    extras : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    Discriminator object on tagged unions.
    pub struct Header {
    required : Bool
    deprecated : Bool
    description : String?
    style : (ParameterStyle, Bool)
    schema : RefOr[Schema]?
    extras : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    HttpMethod

    pub(all) enum HttpMethod {
    Get
    Put
    Post
    Delete
    Options
    Head
    Patch
    Trace
    } derive(Eq,
    Debug
    )

    The eight HTTP methods OpenAPI paths may declare.

    HttpMethod::of_key

    fn HttpMethod::of_key(key : String) -> HttpMethod?

    Parse a path-item member into a method (get -> Some(Get)).

    HttpMethod::to_wire

    fn HttpMethod::to_wire(self : HttpMethod) -> String

    Upper-case wire form (Get -> "GET").

    Info

    pub struct Info {
    title : String
    version : String
    description : String?
    extras : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    LoadedSpec

    pub struct LoadedSpec {
    node : Node
    doc : OpenApiDoc
    diags : Diagnostics
    resolver : Resolver
    }

    The result of loading an OpenAPI document. diags.has_errors() tells callers whether to proceed; the decoded document is returned whenever the document shape was decodable at all.

    MediaType

    pub struct MediaType {
    schema : RefOr[Schema]?
    example : Node?
    encoding : Array[(String, String)]
    extras : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    A media type object under a content-type key.

    Mode

    pub(all) enum Mode {
    Strict
    Lenient
    } derive(Eq,
    Debug
    )

    Severity of unsupported reports in the current mode.

    Node

    pub(all) enum Node {
    Null
    Bool(Bool)
    Number(String)
    Str(String)
    Array(Array[Node])
    Object(ObjectNode)
    } derive(Eq,
    Debug
    )

    Internal scalar/collection tree. Number carries the scalar's exact text (JSON keeps the literal representation via preserve_number_repr=true; YAML materialises Int32-fitting integers as Number and out-of-range integers as Str per bobzhang/yaml, so numeric accessors accept both).

    Node::as_array

    fn Node::as_array(self : Node) -> Array[Node]?

    Node::as_bool

    fn Node::as_bool(self : Node) -> Bool?

    Node::as_double

    fn Node::as_double(self : Node) -> Double?

    Parse as Double via the core JSON parser (handles exponents and exact representations; accepts Number and numeric Str nodes).

    Node::as_int32

    fn Node::as_int32(self : Node) -> Int?

    Parse as Int32. Accepts Number nodes and decimal-integer Str nodes (needed because bobzhang/yaml returns non-Int32 integers as String).

    Node::as_int64

    fn Node::as_int64(self : Node) -> Int64?

    Parse as Int64 (full signed 64-bit range, including Int64::MIN). Accepts Number nodes and decimal-integer Str nodes.

    Node::as_number_text

    fn Node::as_number_text(self : Node) -> String?

    Numeric text of a Number node (scalar text exactly as materialised).

    Node::as_object

    fn Node::as_object(self : Node) -> ObjectNode?

    Node::as_str

    fn Node::as_str(self : Node) -> String?

    Node::as_uint64

    fn Node::as_uint64(self : Node) -> UInt64?

    Parse as UInt64 (full unsigned 64-bit range 0..=18446744073709551615). Accepts Number nodes and decimal-integer Str nodes.

    Node::to_json

    Convert a Node to @json.Json, preserving exact numeric literal text via @json.Json::number(_, repr=...) so 64-bit integer examples round-trip losslessly.

    OAuthFlow

    pub(all) struct OAuthFlow {
    authorization_url : String?
    token_url : String?
    refresh_url : String?
    scopes : Array[(String, String)]
    } derive(Eq,
    Debug
    )

    One OAuth 2.0 flow configuration (implicit, password, clientCredentials, or authorizationCode).

    OAuthFlows

    pub(all) struct OAuthFlows {
    implicit : OAuthFlow?
    password : OAuthFlow?
    client_credentials : OAuthFlow?
    authorization_code : OAuthFlow?
    } derive(Eq,
    Debug
    )

    OAuth 2.0 flows container (components.securitySchemes.<name>.flows).

    ObjectNode

    pub(all) struct ObjectNode {
    entries : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    An ordered object: entries keep source order, so emission and pointer construction are deterministic.

    ObjectNode::contains

    fn ObjectNode::contains(self : ObjectNode, key : String) -> Bool

    True when the key exists.

    ObjectNode::get

    fn ObjectNode::get(self : ObjectNode, key : String) -> Node?

    Look up a key (last value wins, iterating backwards for O(1) early exit).

    ObjectNode::keys

    fn ObjectNode::keys(self : ObjectNode) -> Array[String]

    Keys in source order.

    ObjectNode::length

    fn ObjectNode::length(self : ObjectNode) -> Int

    ObjectNode::new

    fn ObjectNode::new() -> ObjectNode

    OpenApiDoc

    pub struct OpenApiDoc {
    openapi : String
    json_schema_dialect : String?
    info : Info
    servers : Array[Server]
    paths : Array[(String, PathItem)]
    webhooks : Array[(String, PathItem)]
    components : Components?
    security : Array[SecurityAlternative]
    tags : Array[Tag]
    extras : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    Operation

    pub struct Operation {
    operation_id : String
    summary : String?
    description : String?
    tags : Array[String]
    deprecated : Bool
    servers : Array[Server]
    parameters : Array[RefOr[Parameter]]
    request_body : RefOr[RequestBody]?
    responses : Responses
    security : Array[SecurityAlternative]?
    extras : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    Parameter

    pub struct Parameter {
    name : String
    location : ParameterLocation
    required : Bool
    deprecated : Bool
    description : String?
    style : (ParameterStyle, Bool)
    schema : RefOr[Schema]?
    content : Array[(String, MediaType)]
    extras : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    ParameterLocation

    pub(all) enum ParameterLocation {
    Path
    Query
    Header
    Cookie
    } derive(Eq,
    Debug
    )

    A parameter location (in).

    ParameterLocation::of_str

    fn ParameterLocation::of_str(s : String) -> ParameterLocation?

    ParameterStyle

    pub(all) enum ParameterStyle {
    Matrix
    Label
    Form
    Simple
    SpaceDelimited
    PipeDelimited
    DeepObject
    } derive(Eq,
    Debug
    )

    Serialization styles (OpenAPI 3.0 full set; the Golem API uses simple and form).

    ParameterStyle::of_str

    fn ParameterStyle::of_str(s : String) -> ParameterStyle?

    PathItem

    pub struct PathItem {
    ref_ : String?
    summary : String?
    description : String?
    servers : Array[Server]
    operations : Array[(HttpMethod, Operation)]
    parameters : Array[RefOr[Parameter]]
    extras : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    RefOr

    pub(all) enum RefOr[T] {
    Ref(RefTarget)
    Item(T)
    } derive(Eq,
    Debug
    )

    $ref or an inlined value. The reference is kept as its raw string until resolved (Resolver, ref.mbt).

    RefTarget

    pub(all) struct RefTarget {
    ref_ : String
    summary : String?
    description : String?
    siblings : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    RequestBody

    pub struct RequestBody {
    description : String?
    required : Bool
    content : Array[(String, MediaType)]
    extras : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    Resolver

    pub struct Resolver {
    // private fields
    }

    Resolver::new

    fn Resolver::new(root : Node, diags : Diagnostics) -> Resolver

    Resolver::resolve

    fn Resolver::resolve(self : Resolver, ref_ : String) -> Node?

    Resolve a raw $ref string (# or #/components/schemas/Foo) to the node it points at. Both hits and failures are cached so repeated lookups never emit duplicate diagnostics. Does NOT follow $ref aliases at the target — use resolve_ref_chain for that.

    Resolver::resolve_ref_chain

    fn Resolver::resolve_ref_chain(self : Resolver, ref_ : String) -> Node?

    Resolve a $ref value's target and follow any chain of $ref aliases (including objects with ignored sibling keys). Uses a visited set to detect cycles immediately and caps chain depth at 64 hops.

    Response

    pub struct Response {
    description : String
    headers : Array[(String, RefOr[Header])]
    content : Array[(String, MediaType)]
    extras : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    Responses

    pub struct Responses {
    entries : Array[(StatusCode, RefOr[Response])]
    extras : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    Schema

    pub struct Schema {
    type_ : String?
    types : Array[String]
    format : String?
    title : String?
    description : String?
    enum_ : Array[Node]?
    const_ : Node?
    items : RefOr[Schema]?
    properties : Array[(String, RefOr[Schema])]
    required : Array[String]
    additional_properties : AdditionalProperties?
    all_of : Array[RefOr[Schema]]?
    one_of : Array[RefOr[Schema]]?
    any_of : Array[RefOr[Schema]]?
    not : RefOr[Schema]?
    nullable : Bool
    read_only : Bool
    write_only : Bool
    constraints : SchemaConstraints
    discriminator : Discriminator?
    default : Node?
    example : Node?
    examples : Array[Node]
    deprecated : Bool
    extras : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    OpenAPI 3.0 / 3.1 Schema, kept open: recognized keywords are typed, everything else (incl. x- extensions) lands in extras.

    SchemaConstraints

    pub(all) struct SchemaConstraints {
    minimum : String?
    maximum : String?
    exclusive_minimum : String?
    exclusive_maximum : String?
    multiple_of : String?
    min_length : Int?
    max_length : Int?
    pattern : String?
    min_items : Int?
    max_items : Int?
    unique_items : Bool
    min_properties : Int?
    max_properties : Int?
    } derive(Eq,
    Debug
    )

    JSON Schema / OpenAPI validation keywords.

    SchemaConstraints::empty

    SchemaConstraints::is_empty

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

    SecurityAlternative

    pub(all) struct SecurityAlternative {
    schemes : Array[SecurityRequirement]
    } derive(Eq,
    Debug
    )

    One entry of an OpenAPI security array. Entries in the array are OR'd; all schemes inside one SecurityAlternative are AND'd. An empty schemes array corresponds to {} (optional / anonymous access allowed).

    SecurityRequirement

    pub(all) struct SecurityRequirement {
    scheme : String
    scopes : Array[String]
    } derive(Eq,
    Debug
    )

    One scheme requirement inside a security alternative object ("Token": []).

    SecurityScheme

    pub struct SecurityScheme {
    type_ : SecuritySchemeType
    description : String?
    extras : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    Decoded OpenAPI components.securitySchemes entry.

    SecuritySchemeType

    pub(all) enum SecuritySchemeType {
    Http(scheme~ : String, bearer_format~ : String?)
    ApiKey(location~ : ParameterLocation, name~ : String)
    Oauth2(flows~ : OAuthFlows)
    OpenIdConnect(url~ : String)
    Other(String)
    } derive(Eq,
    Debug
    )

    Security scheme type.

    Server

    pub struct Server {
    url : String
    description : String?
    variables : Array[(String, ServerVariable)]
    extras : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    ServerVariable

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

    Severity

    pub(all) enum Severity {
    Error
    Warning
    } derive(Eq,
    Debug
    )

    Severity level of a spec-loading or IR-lowering diagnostic.

    SourceIssue

    pub(all) struct SourceIssue {
    code : String
    pointer : String
    message : String
    } derive(Eq,
    Debug
    )

    A non-fatal issue found while parsing the source (e.g. duplicate keys or unquoted numeric YAML keys).

    StatusCode

    pub(all) enum StatusCode {
    Code(Int)
    Wildcard(String)
    Default
    } derive(Eq,
    Debug
    )

    Status codes: exact three-digit HTTP status (100..=599), canonical uppercase wildcard ("1XX".."5XX"), or "default".

    StatusCode::of_key

    fn StatusCode::of_key(key : String) -> StatusCode?

    Parse a responses key: default, an exact three-digit HTTP status code ("100".."599"), or a wildcard ("1XX".."5XX", normalized to upper).

    Tag

    pub struct Tag {
    name : String
    description : String?
    extras : Array[(String, Node)]
    } derive(Eq,
    Debug
    )

    apply_overlay

    fn apply_overlay(doc : Node, overlay : Node, diags : Diagnostics) -> Node

    Apply an OpenAPI Overlay 1.0 document (overlay) to an OpenAPI Node tree (doc), executing actions in document order.

    bundle_external_refs

    fn bundle_external_refs(root : Node, base_uri? : String, load_doc : (String) -> String raise SpecError, diags : Diagnostics) -> Node

    Bundle all external $ref targets reachable from root into internal #/components/<section>/<Name> entries using a caller-supplied sans-IO document loader load_doc(resolved_uri) -> yaml_or_json_text.

    decode_document

    fn decode_document(root : Node, diags : Diagnostics) -> OpenApiDoc?

    Decode the whole document. Returns None on fatal shape errors (the root, openapi, or info missing/malformed) — diagnostics carry details.

    decode_fragment_segment

    fn decode_fragment_segment(seg : StringView) -> String?

    Decode a single URI-fragment JSON Pointer segment (percent-decode per RFC 6901 §6, then strict ~1/~0 unescape per RFC 6901 §4). Returns None if either percent-decoding or JSON Pointer unescaping fails.

    decode_header

    fn decode_header(node : Node, pointer : String, diags : Diagnostics) -> RefOr[Header]?

    decode_parameter

    fn decode_parameter(node : Node, pointer : String, diags : Diagnostics) -> RefOr[Parameter]?

    decode_path_item

    fn decode_path_item(node : Node, pointer : String, diags : Diagnostics) -> PathItem?

    decode_path_item_ref

    fn decode_path_item_ref(node : Node, pointer : String, diags : Diagnostics) -> RefOr[PathItem]?

    decode_request_body

    fn decode_request_body(node : Node, pointer : String, diags : Diagnostics) -> RefOr[RequestBody]?

    decode_response

    fn decode_response(node : Node, pointer : String, diags : Diagnostics) -> RefOr[Response]?

    decode_schema

    fn decode_schema(node : Node, pointer : String, diags : Diagnostics) -> RefOr[Schema]?

    decode_security_scheme

    fn decode_security_scheme(node : Node, pointer : String, diags : Diagnostics) -> RefOr[SecurityScheme]?

    json_pointer_escape

    fn json_pointer_escape(segment : String) -> String

    JSON-pointer escape per RFC 6901 (~ → ~0, / → ~1).

    json_pointer_unescape

    fn json_pointer_unescape(segment : StringView) -> String

    JSON-pointer unescape per RFC 6901 (~1 → /, ~0 → ~).

    load_json

    fn load_json(text : String, mode? : Mode) -> LoadedSpec raise SpecError

    Load an OpenAPI document from JSON text.

    load_node

    fn load_node(node : Node, mode? : Mode, pre_diags? : Diagnostics) -> LoadedSpec raise SpecError

    Decode an already-parsed Node tree (e.g. after merging specs, applying overlays, or bundling external $refs) into a LoadedSpec.

    load_yaml

    fn load_yaml(text : String, mode? : Mode) -> LoadedSpec raise SpecError

    Load an OpenAPI document from YAML text.

    merge_documents

    fn merge_documents(docs : Array[Node], diags : Diagnostics) -> Node

    Merge one or more OpenAPI Node trees into a single combined document. The first document supplies openapi and info; subsequent documents contribute paths, webhooks, components, tags, servers, and security. Conflicting definitions emit E-merge-conflict (error in Strict mode, warning in Lenient mode).

    parse_json_source

    fn parse_json_source(text : String) -> (Node, Array[SourceIssue]) raise SpecError

    Parse a JSON document. @json.parse is called with duplicate-key rejection and preserve_number_repr=true, so duplicate keys are hard errors and number literals preserve their exact text.

    parse_yaml_source

    fn parse_yaml_source(text : String) -> (Node, Array[SourceIssue]) raise SpecError

    Parse a single-document YAML source. Detects duplicate keys prior to alias resolution and returns them in issues. Raises SpecError on syntax errors, multiple documents, non-string keys, or unresolved aliases.

    pointer_join

    fn pointer_join(pointer : String, segment : String) -> String

    Append one escaped segment to a JSON pointer ("" + "a" → "/a", "/a" + "b/c" → "/a/b~1c").

    ref_or_ref_value

    fn[T] ref_or_ref_value(value : RefOr[T]) -> String?

    The $ref string of a Ref, if it is one.