swagger

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AssetsBase is a base URL for the assets.
	AssetsBase = "https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/5.27.1/"

	// FaviconBase is a base URL for favicons.
	FaviconBase = "https://petstore.swagger.io/"
)

Variables

This section is empty.

Functions

func IndexTpl

func IndexTpl(assetsBase, faviconBase string, cfg config.Swagger) string

IndexTpl creates page template.

Types

type Data

type Data struct {
	Title              string            `json:"title"`
	OpenAPIYAMLURL     string            `json:"openapiYamlUrl"`
	ShowTopBar         bool              `json:"showTopBar"`
	HideCurl           bool              `json:"hideCurl"`
	JsonEditor         bool              `json:"jsonEditor"`
	PreAuthorizeApiKey map[string]string `json:"-"`
	SettingsUI         map[string]string `json:"-"`
}

type Handler

type Handler struct {
	Data

	ConfigJson template.JS
	// contains filtered or unexported fields
}

Handler handles swagger UI request.

func NewHandler

func NewHandler(config *config.SpecUI) *Handler

NewHandler returns a HTTP handler for swagger UI.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler interface to handle swagger UI request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL