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

settings

package
v3.0.23 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 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

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

func DecodeValues

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

func DefaultValues

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

func NormalizeRawValues

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

Types

type Field

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

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

type Schema

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

func CanonicalSchema

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

func CanonicalizeSchema

func CanonicalizeSchema(schema Schema) (Schema, error)

type Validation

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