uiopt

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package uiopt holds the option machinery shared by the bundled UI sub-packages (ui/scalar, ui/swaggerui, ui/redoc, ui/stoplight and their embedded twins). It is internal: only stdocs's own UI packages import it. Each UI package re-exports Option as its own UIOption type and Configuration as its own WithConfiguration, so the wiring lives in one place while the public API stays per-package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Merge

func Merge(base, over map[string]any) map[string]any

Merge overlays over onto a copy of base, with over winning on key conflicts (a shallow, top-level merge). UI sub-packages use it to apply their CSP-safe defaults while letting a caller's WithConfiguration override any key. It returns nil when the result is empty, so a UI with no defaults and no caller config renders no configuration carrier and stays byte-identical to the unconfigured page.

Types

type Option

type Option func(*Settings)

Option mutates Settings.

func Configuration

func Configuration(cfg map[string]any) Option

Configuration is the shared implementation of every UI's WithConfiguration: it records the configuration map for the UI to render into its docs page.

type Settings

type Settings struct {
	// Config is the UI-native configuration set by WithConfiguration,
	// forwarded to stdocs.Config.UIConfig. nil when unset.
	Config map[string]any
}

Settings accumulates the options passed to a UI sub-package's WithUI.

func Apply

func Apply(opts []Option) Settings

Apply folds opts into a fresh Settings.

Jump to

Keyboard shortcuts

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