Documentation
¶
Overview ¶
Package spec loads the embedded OpenAPI document and derives the CLI's command surface from it.
Index ¶
- Constants
- func ApplyPaging(req *Request, cmd Command, p Paging)
- func DeriveName(tag, operationID string) (resource, action string)
- func EventTypes(doc *openapi3.T) []string
- func Load() (*openapi3.T, error)
- func Skeleton(cmd Command) (string, error)
- func StripComments(s string) string
- type Command
- type Field
- type Input
- type Operation
- type Page
- type Paging
- type Region
- type Registry
- func (r *Registry) Actions(resource string) []string
- func (r *Registry) Columns(resource string) []string
- func (r *Registry) Commands() []Command
- func (r *Registry) Excluded() []string
- func (r *Registry) Lookup(resource, action string) (Command, bool)
- func (r *Registry) Resources() []string
- func (r *Registry) Warnings() []string
- type Request
Constants ¶
const WebhookEventsTag = "Webhook Events"
Marks 56 documentation stubs with no operationId, synthetic paths, and a 404 on call — excluded from commands but kept as the event-type list.
Variables ¶
This section is empty.
Functions ¶
func ApplyPaging ¶
Sets limit/offset in the query for GET or the body for POST search operations, never overwriting values the caller already supplied.
func DeriveName ¶
Pure function of tag and operationId, whose stability is already an SDK contract, so derived names are just as stable.
func EventTypes ¶
EventTypes reads webhook event names off the excluded stubs. These drive validation and completion for `trigger` and `listen --events`.
func Skeleton ¶
Only required fields are emitted live; optional ones are commented out, since an untouched optional numeric field sent as "" fails request binding.
func StripComments ¶
StripComments removes // lines so an edited skeleton can be parsed as JSON.
Types ¶
type Field ¶
type Field struct {
Name string
Type string
Required bool
Nested bool // objects and arrays cannot be expressed as a scalar flag
Doc string
}
Field describes one settable body or query field, used for --help and --edit.
func BodyFields ¶
BodyFields lists the top-level properties of the request body schema.
type Input ¶
type Input struct {
PositionalID string
Flags map[string]string
Data map[string]any // from --data or --edit
}
Input is everything the user supplied on the command line.
type Operation ¶
type Operation struct {
ID string
Method string
Path string
Tag string
Op *openapi3.Operation
Item *openapi3.PathItem
}
Operation is one callable API operation.
func Operations ¶
Operations returns every callable operation, excluding the webhook stubs and anything without an operationId.
type Page ¶
Page describes one response page. Total is 0 when the response is not a list.