Help us shape the future of Go! Take the 2026 Go Developer Survey

openapi

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package openapi derives agent.yaml capabilities from an existing OpenAPI spec, for `gora8 deploy --from-openapi` — so a SaaS company with a multi-operation REST API doesn't hand-author `capabilities:` one entry at a time.

This package deliberately does NOT parse parameters, request bodies, or build HTTP requests — that's the job of adapters-python's rest.py (gora8_adapters.rest), which is what actually runs the wrapper and calls the wrapped API. This package only needs enough of the spec to answer "what operations exist, and what should each be called and described as a capability" — the CLI never calls the wrapped API itself, so it never needs to know how to.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(path string) (map[string]Operation, error)

Load reads and parses an OpenAPI spec from a local file path (JSON or YAML, detected by content, not extension — the same convention adapters-python's rest.py uses) and returns every operation it declares, keyed by operationId (or a "method_path" fallback for operations that don't declare one). A malformed path or method entry is skipped, not fatal — one bad operation in a large spec shouldn't block deploying the other 39.

Types

type Capability

type Capability struct {
	ID          string
	Description string
}

Capability is a plain id+description pair — deliberately not card.YAMLCapability, so this package stays decoupled from the CLI's specific manifest shape; callers convert at the call site.

func Capabilities

func Capabilities(path string, allow []string) ([]Capability, error)

Capabilities derives agent.yaml capability entries from a spec file, one per operation, filtered to `allow` if non-empty — an explicit operationId allowlist. Deliberately doesn't default to publishing every operation a spec declares: account management, billing, and admin endpoints usually don't belong on gora8 even when an API's real task-shaped operations do.

type Operation

type Operation struct {
	OperationID string
	Method      string
	Path        string
	Summary     string
	Description string
}

Operation is the subset of an OpenAPI operation this package cares about — just enough to name and describe a capability.

Jump to

Keyboard shortcuts

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