Help us shape the future of Go! Take the 2026 Go Developer Survey

settings

package
v0.7.27 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldString  = "string"
	FieldBoolean = "boolean"
	FieldNumber  = "number"
	FieldInteger = "integer"
	FieldEnum    = "enum"
	FieldSelect  = "select"
	FieldSecret  = "secret"
)

Variables

View Source
var ErrInvalidSetting = errors.New("plugin setting is invalid")

Functions

func CanonicalSchemaJSON added in v0.5.0

func CanonicalSchemaJSON(spec *manifest.SettingsSpec) ([]byte, error)

func DecodeValues added in v0.5.0

func DecodeValues(values map[string]json.RawMessage) (map[string]any, error)

func DefaultValues added in v0.5.0

func DefaultValues(fields []Field) (map[string]json.RawMessage, error)

func NormalizeRawValues added in v0.5.0

func NormalizeRawValues(fields []Field, values map[string]json.RawMessage) (map[string]json.RawMessage, error)

Types

type Field added in v0.5.0

type Field struct {
	Key        string          `json:"key"`
	Type       string          `json:"type"`
	Scope      string          `json:"scope"`
	Options    []string        `json:"options,omitempty"`
	Default    json.RawMessage `json:"default,omitempty"`
	Validation *Validation     `json:"validation,omitempty"`
}

func NonSecretFields added in v0.5.0

func NonSecretFields(spec *manifest.SettingsSpec) ([]Field, error)

type Schema added in v0.5.0

type Schema struct {
	SchemaVersion int     `json:"schema_version"`
	Fields        []Field `json:"fields,omitempty"`
}

func CanonicalSchema added in v0.5.0

func CanonicalSchema(spec *manifest.SettingsSpec) (Schema, error)

func CanonicalizeSchema added in v0.5.0

func CanonicalizeSchema(schema Schema) (Schema, error)

type Validation added in v0.5.0

type Validation struct {
	Minimum   *float64 `json:"minimum,omitempty"`
	Maximum   *float64 `json:"maximum,omitempty"`
	MinLength *uint64  `json:"min_length,omitempty"`
	MaxLength *uint64  `json:"max_length,omitempty"`
}

Jump to

Keyboard shortcuts

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