schema

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalCompact

func MarshalCompact(v any) ([]byte, error)

func Products

func Products() []string

Types

type APICall

type APICall struct {
	API                  string `json:"api"`
	Phase                string `json:"phase"`
	Condition            string `json:"condition,omitempty"`
	ConditionDescription string `json:"condition_description,omitempty"`
	Purpose              string `json:"purpose"`
	Repeated             bool   `json:"repeated,omitempty"`
	Cached               bool   `json:"cached,omitempty"`
}

type Capabilities

type Capabilities struct {
	SchemaVersion int              `json:"schema_version"`
	CLI           string           `json:"cli"`
	Surface       string           `json:"surface"`
	OutputModes   []string         `json:"output_modes"`
	Schema        SchemaCapability `json:"schema"`
	Errors        ErrorContract    `json:"errors"`
	Products      []ProductSurface `json:"products"`
}

func CapabilitiesForLanguage

func CapabilitiesForLanguage(lang string) (Capabilities, bool)

type CommandSchema

type CommandSchema struct {
	SchemaVersion int               `json:"schema_version"`
	Command       string            `json:"command"`
	SchemaID      string            `json:"schema_id,omitempty"`
	CLI           string            `json:"cli,omitempty"`
	Usage         string            `json:"usage,omitempty"`
	Kind          string            `json:"kind"`
	Risk          Risk              `json:"risk"`
	Description   string            `json:"description"`
	Positionals   []PositionalParam `json:"positionals,omitempty"`
	Params        map[string]Param  `json:"params"`
	Filters       map[string]Filter `json:"filters,omitempty"`
	Examples      []string          `json:"examples,omitempty"`
	Output        *OutputShape      `json:"output,omitempty"`
	Contract      *Contract         `json:"contract,omitempty"`
	APICalls      []APICall         `json:"api_calls,omitempty"`
}

func Command

func Command(name string) (CommandSchema, bool)

func CommandForLanguage

func CommandForLanguage(name string, lang string) (CommandSchema, bool)

func CommandForLanguageMode

func CommandForLanguageMode(name string, lang string, mode CommandSchemaMode) (CommandSchema, bool)

type CommandSchemaMode

type CommandSchemaMode string
const (
	CommandSchemaBrief CommandSchemaMode = "brief"
	CommandSchemaFull  CommandSchemaMode = "full"
)

type Contract

type Contract struct {
	DryRun      Support             `json:"dry_run"`
	Idempotency IdempotencyContract `json:"idempotency"`
	Wait        *WaitContract       `json:"wait,omitempty"`
}

type ErrorContract

type ErrorContract struct {
	Structured   bool     `json:"structured"`
	Stream       string   `json:"stream"`
	Fields       []string `json:"fields"`
	ActionFields []string `json:"action_fields"`
}

type Filter

type Filter struct {
	Type        string `json:"type"`
	Description string `json:"description,omitempty"`
}

type IdempotencyContract

type IdempotencyContract struct {
	Supported bool   `json:"supported"`
	Field     string `json:"field,omitempty"`
	Prefix    string `json:"prefix,omitempty"`
	Mode      string `json:"mode,omitempty"`
	Reason    string `json:"reason,omitempty"`
}

type OutputShape

type OutputShape struct {
	Root   string   `json:"root,omitempty"`
	Fields []string `json:"fields,omitempty"`
}

type Param

type Param struct {
	Type           string           `json:"type"`
	Description    string           `json:"description,omitempty"`
	Required       bool             `json:"required,omitempty"`
	Repeatable     bool             `json:"repeatable,omitempty"`
	Positional     bool             `json:"positional,omitempty"`
	PositionalMany bool             `json:"positional_many,omitempty"`
	Default        any              `json:"default,omitempty"`
	Input          string           `json:"input,omitempty"`
	Items          *Param           `json:"items,omitempty"`
	Fields         map[string]Param `json:"fields,omitempty"`
}

type PositionalParam

type PositionalParam struct {
	Name        string `json:"name"`
	Type        string `json:"type,omitempty"`
	Description string `json:"description,omitempty"`
	Required    bool   `json:"required,omitempty"`
	Many        bool   `json:"many,omitempty"`
	Input       string `json:"input,omitempty"`
}

type ProductSummary

type ProductSummary struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

func ProductsForLanguage

func ProductsForLanguage(lang string) []ProductSummary

type ProductSurface

type ProductSurface struct {
	Product     string            `json:"product"`
	Description string            `json:"description,omitempty"`
	Resources   []ResourceSurface `json:"resources"`
}

func ProductList

func ProductList(product string) (ProductSurface, bool)

func ProductListForLanguage

func ProductListForLanguage(product string, lang string) (ProductSurface, bool)

type ResourceSurface

type ResourceSurface struct {
	Product     string   `json:"product,omitempty"`
	Name        string   `json:"name"`
	Parent      string   `json:"parent,omitempty"`
	SchemaID    string   `json:"schema_id"`
	Description string   `json:"description,omitempty"`
	Actions     []string `json:"actions"`
}

func ResourceForLanguage

func ResourceForLanguage(product string, requested string, lang string) (ResourceSurface, bool)

func ResourceForLanguageName

func ResourceForLanguageName(name string, lang string) (ResourceSurface, bool)

type Risk

type Risk struct {
	Level       string `json:"level"`
	Description string `json:"description"`
}

type SchemaCapability

type SchemaCapability struct {
	Supported    bool     `json:"supported"`
	ListCommands []string `json:"list_commands"`
	GetCommand   string   `json:"get_command"`
}

type Support

type Support struct {
	Supported bool   `json:"supported"`
	Flag      string `json:"flag,omitempty"`
	Reason    string `json:"reason,omitempty"`
}

type WaitContract

type WaitContract struct {
	Waitable    bool             `json:"waitable"`
	NoWaitFlag  string           `json:"no_wait_flag,omitempty"`
	TimeoutFlag string           `json:"timeout_flag,omitempty"`
	PollCommand string           `json:"poll_command,omitempty"`
	Waiters     []WaiterContract `json:"waiters,omitempty"`
}

type WaiterContract

type WaiterContract struct {
	Name          string   `json:"name"`
	Probe         string   `json:"probe,omitempty"`
	Target        string   `json:"target,omitempty"`
	Interval      string   `json:"interval,omitempty"`
	Timeout       string   `json:"timeout,omitempty"`
	FailureStates []string `json:"failure_states,omitempty"`
}

Jump to

Keyboard shortcuts

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