moonbitstack/moonapi/openapi does not have a README file

    ApiInfo

    pub(all) struct ApiInfo {
    title : String
    summary : String
    api_version : String
    description : String
    terms_of_service : String
    contact : Contact?
    license : License?
    servers : Array[Server]
    tags : Array[Tag]
    external_docs : ExternalDocs?
    }

    What the document says about the API itself — FastAPI's info block plus servers, the tag descriptions and the external documentation. An app carries one (App::describe sets it) so that every emission of the document, including the route enable_docs registers, agrees.

    ApiInfo::new

    fn ApiInfo::new() -> ApiInfo

    The defaults an app starts with.

    Contact

    pub(all) struct Contact {
    name : String
    url : String
    email : String
    }

    OpenAPI contact info (← FastAPI's contact): every field optional, emitted only when non-empty.

    Contact::new

    fn Contact::new(name? : String, url? : String, email? : String) -> Contact

    ExternalDocs

    pub(all) struct ExternalDocs {
    url : String
    description : String
    }

    A link to documentation kept elsewhere: the externalDocs object, on the document or on a tag.

    ExternalDocs::new

    fn ExternalDocs::new(url : String, description? : String) -> ExternalDocs

    ExternalDocs::to_json

    The externalDocs object for docs, the same in every dialect.

    License

    pub(all) struct License {
    name : String
    url : String
    identifier : String
    }

    OpenAPI license info (← FastAPI's license_info): name required, then either a url or, in OpenAPI 3.1, an SPDX identifier. The two exclude each other in 3.1, so there an identifier is written and the url is not; the older dialects have no identifier and get the url.

    License::new

    fn License::new(name : String, url? : String, identifier? : String) -> License

    Server

    pub(all) struct Server {
    url : String
    description : String
    }

    A servers entry (← FastAPI's servers): a base URL and an optional description.

    Server::new

    fn Server::new(url : String, description? : String) -> Server

    Tag

    pub(all) struct Tag {
    name : String
    description : String
    external_docs : ExternalDocs?
    }

    What the document says about one operation tag (← FastAPI's openapi_tags): documentation viewers group operations by tag, in the order the tags are listed here, and show this description above each group.

    Tag::new

    fn Tag::new(name : String, description? : String, external_docs? : ExternalDocs) -> Tag

    Tag::to_json

    fn Tag::to_json(self : Tag) ->
    Json

    The tag object, the same in every dialect.

    Theme

    pub(all) enum Theme {
    Site
    Plain
    } derive(Eq,
    Debug
    )

    How a page looks. Site is the theme of this library's own site: the periwinkle paper, the iris accent, the display face and the thin scrollbars, on a bar naming the application and pointing at its document. Plain is the reader as its maker ships it — no bar, no fonts, no colours of ours — for a page that is dropped into a site of its own.

    Theme::equal

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

    Theme::not_equal

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

    Theme::to_repr

    pub(all) enum Ui {
    Scalar
    Swagger
    Redoc
    Redocly
    } derive(Eq,
    Debug
    )

    Which reader a page serves. Scalar is the current generation of API reference, with a request client built in; Swagger is Swagger UI, the long-standing one; Redoc reads without letting a caller try anything, and Redocly is Redocly's own reference, which needs a licence key.

    Ui::equal

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

    Ui::not_equal

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

    Ui::to_repr

    redoc_js

    let redoc_js : String

    redoc_ui

    fn redoc_ui(spec_url? : String, title? : String, js_url? : String, telemetry? : Bool, theme? : Theme) -> String

    A ReDoc page rendering the document served at spec_url (← FastAPI's get_redoc_html): three panels, built for reading rather than for trying calls out. ReDoc reports usage to its maker unless told not to; telemetry is off unless turned on, since the page is served to this API's readers.

    redocly_js

    let redocly_js : String

    Redocly's reference is served from Redocly's own CDN and is licensed per deployment: the page carries the licence key its options name.

    redocly_ui

    fn redocly_ui(spec_url? : String, title? : String, js_url? : String, extra? : Map[String,
    Json
    ], theme? : Theme) -> String

    A Redocly reference rendering the document served at spec_url: the reference and a request console on one page. extra is merged over the options passed to RedoclyReferenceDocs.init, which is where the licence key, the theming and the code samples go; without a key the reference renders under Redocly's banner.

    scalar_js

    let scalar_js : String

    scalar_ui

    fn scalar_ui(spec_url? : String, title? : String, js_url? : String, extra? : Map[String,
    Json
    ], theme? : Theme) -> String

    A Scalar API reference rendering the document served at spec_url: the reference and a request client on one page. extra is merged over the configuration passed to Scalar.createApiReference, which is where its theme, layout and authentication defaults go.

    swagger_css

    let swagger_css : String

    swagger_js

    let swagger_js : String

    The pages load their readers from a CDN at an exact version, so a page does not change under an application that did not change. Self-hosting is a matter of passing other URLs.

    swagger_redirect

    fn swagger_redirect(js_url? : String) -> String

    The page an OAuth2 authorisation started from Swagger UI returns to: it hands the code or token back to the window that opened it (← FastAPI's get_swagger_ui_oauth2_redirect_html).

    swagger_redirect_js

    let swagger_redirect_js : String

    swagger_ui

    fn swagger_ui(spec_url? : String, title? : String, js_url? : String, css_url? : String, oauth2_redirect_url? : String, init_oauth? :
    Json
    , extra? : Map[String,
    Json
    ], theme? : Theme) -> String

    A Swagger UI page rendering the document served at spec_url (← FastAPI's get_swagger_ui_html). oauth2_redirect_url is the page an OAuth2 flow returns to, served by swagger_redirect; init_oauth is handed to initOAuth to prefill the client id, scopes and the like; extra is merged over the settings passed to Swagger UI (← swagger_ui_parameters).

    theme

    let theme : Theme

    The theme a page wears unless told otherwise.