stoplight

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

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

func WithUI

func WithUI() stdocs.Option

WithUI returns a stdocs.Option that replaces the default docs page with Stoplight Elements.

Types

This section is empty.

Jump to

Keyboard shortcuts

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