swaggerui

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 5 Imported by: 0

README

Vendored Swagger UI

assets/ holds three files from the swagger-ui-dist npm package, release 5.17.14 (Apache-2.0; LICENSE and NOTICE are kept beside them):

file sha256
swagger-ui-bundle.js c2e4a9ef08144839ff47c14202063ecfe4e59e70a4e7154a26bd50d880c88ba1
swagger-ui.css 40170f0ee859d17f92131ba707329a88a070e4f66874d11365e9a77d232f6117

Only the bundle and the stylesheet are used; the package's index.html, standalone preset and source maps are left out.

Updating

  1. In an empty directory outside the repository: npm pack swagger-ui-dist@<version> (npm checks the tarball's integrity), then extract it.
  2. Copy swagger-ui-bundle.js, swagger-ui.css, LICENSE and NOTICE into assets/.
  3. Update Version in swaggerui.go and the table above (shasum -a 256).
  4. Run go test ./openapi/... and open /docs/ in a browser against an app with a documented route.
  5. Record the version in the changelog.

Documentation

Overview

Package swaggerui serves Swagger UI, embedded in the binary, for the openapi package:

openapi.New(openapi.Options{UI: swaggerui.New()})

Importing it adds about 1.5 MB to the binary, which is why it is a package of its own: an app that only wants the document does not import it. Nothing is fetched from the network, so the page works offline and under a strict Content-Security-Policy that allows same-origin scripts and styles (Swagger UI sets inline styles, so style-src needs 'unsafe-inline').

Index

Constants

View Source
const Version = "5.17.14"

Version is the swagger-ui-dist release the assets come from.

Variables

This section is empty.

Functions

This section is empty.

Types

type UI

type UI struct{}

UI is the Swagger UI page and its files.

func New

func New() UI

New returns the embedded Swagger UI.

func (UI) Routes

func (UI) Routes(base, specPath string) []tango.Route

Routes returns the routes that serve the page under base (a path ending in "/", such as "/docs/") for the document at specPath. The openapi package calls it.

Jump to

Keyboard shortcuts

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