settings

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package settings helps plugins describe and validate their settings with JSON Schema (draft 2020-12), the format Panelarr hosts use to render settings and configuration forms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Schema

type Schema struct {
	// contains filtered or unexported fields
}

Schema is a compiled settings schema.

func FromStruct

func FromStruct(s *structpb.Struct) (*Schema, error)

FromStruct compiles a JSON Schema document given as a protobuf Struct, as returned by GetSettingsSchema.

func Parse

func Parse(doc string) (*Schema, error)

Parse compiles a JSON Schema document given as JSON text.

The order properties are written in is lost on the way to a host (a protobuf Struct and JSON maps sort keys), so Parse stamps it on every property, at every depth, as "x-order": 1, 2, 3, … in the order written. Forms show fields in that order. A property that already has "x-order" or "propertyOrder" keeps it.

func (*Schema) Doc

func (s *Schema) Doc() map[string]any

Doc returns the schema document. Don't change it.

func (*Schema) Struct

func (s *Schema) Struct() *structpb.Struct

Struct returns the schema document as a protobuf Struct.

func (*Schema) Validate

func (s *Schema) Validate(values map[string]any) error

Validate checks values against the schema.

func (*Schema) WithDefaults

func (s *Schema) WithDefaults(values map[string]any) map[string]any

WithDefaults returns values with the schema's top-level property defaults filled in where a value is missing.

func (*Schema) WriteOnly

func (s *Schema) WriteOnly() []string

WriteOnly returns the top-level properties the schema marks "writeOnly": secrets such as API keys, which are never read back.

Jump to

Keyboard shortcuts

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