Sign in

    moonbitstack/moonctl/doc does not have a README file

    DocVersion

    pub(all) enum DocVersion {
    Swagger20
    OpenApi30
    OpenApi31
    } derive(Eq)

    Target OpenAPI / Swagger document version. mctl emits every mainstream version from one .api spec — the same shape moonapi's runtime emitter takes, so a generated service and a hand-built moonapi app document the same way.

    DocVersion::equal

    fn DocVersion::equal(DocVersion, DocVersion) -> Bool

    DocVersion::not_equal

    fn DocVersion::not_equal(x : DocVersion, y : DocVersion) -> Bool

    generate_doc

    fn generate_doc(spec :
    Spec
    , version? : DocVersion, title? : String, api_version? : String) -> String

    Generate an OpenAPI / Swagger document from spec, stringified with two-space indentation. version picks the dialect (Swagger 2.0 / OpenAPI 3.0 / 3.1).

    openapi_document

    fn openapi_document(spec :
    Spec
    , version? : DocVersion, title? : String, api_version? : String) -> Json

    Build the OpenAPI / Swagger document for spec as a Json value. Routes fold into paths → HTTP method → operation (with operationId, any :name path parameters, and a 200 response); every type block becomes a component schema (definitions in 2.0, components/schemas in 3.x). version selects the document dialect; title/api_version fill the info block.

    swagger_ui_stub

    fn swagger_ui_stub(spec_url? : String, title? : String) -> String

    A self-contained Swagger UI page for the document served at spec_url. The same stub moonapi ships, so a generated service and a live app render alike.

    Source Files