spec

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MPL-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package spec holds the operation table generated from the Gyro Public API OpenAPI document (internal/spec/openapi.yaml, synced from moduller/gyro-api/openapi.yaml by scripts/sync-spec.sh).

The table (zz_generated_ops.go) is produced by cmd/gyro-gen. Every operation becomes a CLI command automatically (see internal/cli/generated.go); hand-written commands only add nicer UX on top.

Index

Constants

View Source
const APIVersion = "2.26.0"

APIVersion is info.version of the spec this table was generated from.

Variables

View Source
var Ops = []Op{}/* 438 elements not displayed */

Ops lists every API operation.

Functions

func Dangerous

func Dangerous(method, opID, action, scope string, hasConfirm bool) bool

Dangerous reports whether running the operation should ask for confirmation.

func FirstWord

func FirstWord(id string) string

FirstWord returns the leading verb of an operationId (runServiceTool -> run).

func Kebab

func Kebab(s string) string

Kebab turns operationIds / snake_case / camelCase into kebab-case.

func Name

func Name(in NameInput) (resource []string, action string)

Name derives the command words for an operation.

func Singular

func Singular(s string) string

Singular converts a plural path noun to its singular command name.

func Verb

func Verb(opID string) string

Verb returns the leading verb of an operationId, ignoring a "core" prefix (coreSendAuthCode -> send).

Types

type Field

type Field struct {
	Name     string
	Type     string
	Items    string
	Enum     []string
	Default  string
	Required bool
	Desc     string
	DescTR   string
}

Field is one top-level property of a JSON request body.

type NameInput

type NameInput struct {
	Method, Path, OpID string
	ListResp           bool // data is an array
	HasGet             bool // a GET exists on the same path
	HasOtherMethods    bool // PUT/PATCH/DELETE exist on the same path
	HasChildParam      bool // a path "<this>/{param}" exists (so this path is a collection)
	TrailingEnum       bool // last path parameter has an enum (one command per value)
}

NameInput describes an operation and its neighbourhood in the spec.

type Op

type Op struct {
	ID        string
	Method    string
	Path      string
	Tag       string
	Summary   string
	SummaryTR string
	Desc      string
	DescTR    string
	Scope     string // x-scope (cloud_read, cloud_order, ...)

	Params       []Param
	Body         []Field
	HasBody      bool
	BodyRequired bool

	ListResponse bool     // data is an array (or data.<ItemsKey> is)
	ItemsKey     string   // "items" when the list is wrapped: {"data": {"items": [...], "quota_gb": 5}}
	Paginated    bool     // has a page query parameter
	Columns      []string // default table columns (response item properties, spec order)

	Command []string // e.g. ["server", "snapshot", "list"]; derived by Name() unless x-cli.command is set
	Confirm bool     // destructive or money: ask before running
	Money   bool     // spends money (dry-run gives a quote when the body supports it)
	Hidden  bool     // x-cli.hidden
}

Op is one API operation plus the CLI command derived from it.

func ByID

func ByID(id string) *Op

ByID returns the operation with the given operationId.

func (*Op) Field

func (o *Op) Field(name string) (Field, bool)

Field returns the body field with the given name.

func (*Op) Param

func (o *Op) Param(name string) (Param, bool)

Param returns the parameter with the given name.

func (*Op) PathParams

func (o *Op) PathParams() []Param

PathParams returns the path parameters in URL order.

type Param

type Param struct {
	Name     string
	In       string // path | query | header
	Type     string // string | integer | number | boolean | array | object
	Items    string // element type for arrays
	Enum     []string
	Default  string
	Required bool
	Desc     string
	DescTR   string
}

Param is a path, query or header parameter.

Jump to

Keyboard shortcuts

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