Sign in

    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

    fn ExternalDocs::to_json(self : ExternalDocs) -> 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.
    pub(all) enum Ui {
    Scalar
    Swagger
    } derive(Eq,
    Debug
    )

    Which reader /docs serves. Scalar is the current generation of API reference, with a request client built in; Swagger is Swagger UI, the long-standing one.

    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) -> 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.

    scalar_js

    let scalar_js : String

    scalar_ui

    fn scalar_ui(spec_url? : String, title? : String, js_url? : String, extra? : Map[String, Json]) -> 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]) -> 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).

    Source Files