Documentation
¶
Overview ¶
Package stoplight provides a Stoplight Elements UI for stdocs.
Stoplight Elements is a modern OpenAPI viewer that supports OpenAPI 3.0.x and 3.1.x, loaded from a CDN. To use it, import this sub-package and pass stoplight.WithUI() to stdocs.New or stdocs.DocsHandler:
import (
"github.com/FumingPower3925/stdocs"
"github.com/FumingPower3925/stdocs/ui/stoplight"
)
mux := stdocs.New(stdocs.WithTitle("My API"), stoplight.WithUI())
mux.HandleFunc("GET /x", h)
mux.Mount()
This sub-package adds the Stoplight HTML to the docs handler. The Stoplight web components and stylesheet are loaded from cdn.jsdelivr.net at page load time, so an internet connection is required.
The CDN URLs are pinned to a specific version (9.0.22) and point at the verbatim web-components.min.js and styles.min.css files from the npm package, so their bytes are deterministic and the sha384 SRI hashes below are pinned in the <script>/<link> tags. Bumping the pinned version requires re-computing the hashes. For an air-gapped build, use the ui/stoplightemb sub-package instead — it vendors the bundle in-repo.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.