Documentation
¶
Overview ¶
Package swaggerui serves a vendored copy of Swagger UI.
Swagger UI (https://github.com/swagger-api/swagger-ui) is distributed under the Apache License 2.0, see dist/LICENSE and dist/NOTICE.
The package depends on the standard library only, so importing it from generated code does not add any third-party dependencies to the resulting binary.
Index ¶
Constants ¶
View Source
const Version = "5.33.2"
Version is the version of the vendored swagger-ui-dist package.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// SpecURL is the URL of the OpenAPI document to render.
//
// A relative URL is resolved by the browser against the page URL,
// so "openapi.json" works wherever the handler is mounted.
SpecURL string
// Title is the HTML page title. Defaults to "Swagger UI".
Title string
// AssetsURL is the base URL (with a trailing slash) to load Swagger UI
// static files from, for example a CDN like "https://unpkg.com/swagger-ui-dist@5/".
//
// If empty, the files embedded into this package are served by Handler.
AssetsURL string
}
Config configures Handler.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler serves Swagger UI: the index page at "/" (or "") and, unless Config.AssetsURL is set, static files at "/<name>".
Paths are relative to the mount point: use http.StripPrefix to mount the handler under a sub-path.
Click to show internal directories.
Click to hide internal directories.