Documentation
¶
Overview ¶
Package openapi serves an OpenAPI specification and a Stoplight Elements docs site (interactive, with a "try it" console) from a single Register call. The Stoplight Elements assets are embedded in the framework, so a project ships only its generated spec — no per-project vendoring of the UI.
The Stoplight Elements distribution under assets/ is vendored from https://stoplight.io/open-source/elements (Apache-2.0), pinned at v9.0.0.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
Register mounts the OpenAPI spec and the Stoplight Elements docs site onto the provided mux:
GET /openapi.yaml -> the spec bytes GET /docs/ -> the Stoplight UI (try-it console)
Serving both on the same server keeps the spec same-origin with the API it documents, so the "try it" console works without extra CORS configuration.
Types ¶
type Option ¶
type Option func(*config)
Option configures the docs endpoints.
func WithDocsPath ¶
WithDocsPath sets the path prefix the Stoplight UI is served at (default "/docs/"). It must end in a slash.
func WithSpecPath ¶
WithSpecPath sets the path the OpenAPI document is served at (default "/openapi.yaml").