schema

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OperationInfo

type OperationInfo struct {
	Name                 string          `json:"name"`
	Method               string          `json:"method"`
	Path                 string          `json:"path"`
	Summary              string          `json:"summary,omitempty"`
	Description          string          `json:"description,omitempty"`
	Parameters           []ParameterInfo `json:"parameters,omitempty"`
	HasRequestBody       bool            `json:"has_request_body,omitempty"`
	RequestBodySchemaRef string          `json:"request_body_schema_ref,omitempty"`
	RequiredScope        string          `json:"required_scope,omitempty"`
}

OperationInfo describes a single API operation.

type ParameterInfo

type ParameterInfo struct {
	Name     string `json:"name"`
	In       string `json:"in"`
	Required bool   `json:"required"`
	Type     string `json:"type"`
}

ParameterInfo describes a single parameter of an API operation.

type ResourceInfo

type ResourceInfo struct {
	Resource   string          `json:"resource"`
	Operations []OperationInfo `json:"operations"`
}

ResourceInfo describes a CLI resource and its available API operations.

type Schema

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

Schema holds the parsed OpenAPI spec and provides methods to query it.

A Schema instance is bound to one of the supported APIs (accounting or invoice) via its pathMap, so the same parser can describe both APIs without state leaking between them. Use NewAccounting or NewInvoice to pick the API; New is preserved as an alias for the accounting variant.

func New

func New(specData []byte) (*Schema, error)

New parses an OpenAPI spec and returns a Schema bound to the accounting path map. It is preserved for backwards compatibility; new callers should prefer NewAccounting or NewInvoice for clarity.

func NewAccounting added in v0.2.0

func NewAccounting(specData []byte) (*Schema, error)

NewAccounting parses the accounting OpenAPI spec.

func NewInvoice added in v0.2.0

func NewInvoice(specData []byte) (*Schema, error)

NewInvoice parses the invoice OpenAPI spec.

func (*Schema) Describe

func (s *Schema) Describe(resource string) (*ResourceInfo, error)

Describe returns detailed information about all operations for a given CLI resource.

func (*Schema) ListResources

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

ListResources returns a sorted list of available CLI resource names for the API this Schema was constructed for.

Jump to

Keyboard shortcuts

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