Documentation
¶
Overview ¶
Package openapi implements FR-MCP-06's `vegaload new --from-openapi` and the generate_from_spec MCP tool: turning an OpenAPI document into a ready-to-run starting point for load testing its endpoints.
It parses JSON OpenAPI specs only — no YAML parser, deliberately, to avoid adding a new go.mod dependency (see go.mod's pinning history). Most tooling (Swagger UI, most API gateways) can export a spec as JSON even when the canonical source is YAML, so this is a real limitation but rarely a blocking one.
It also scaffolds a runbook, not a working scenario script. The scripting runtimes (internal/scripting/js and /python) can make real HTTP/WebSocket calls per FR-CLI-08, but only along a flow someone actually wrote — chaining a response from one endpoint into the next call, retrying, reading a WebSocket until some condition. An OpenAPI spec describes each endpoint in isolation; it says nothing about how they relate, so generating a scenario that "chains" them would be guessing at an order and a data flow the spec never specified. RenderRunbook instead produces the exact `vegaload run -target ... -protocol http1 ...` command for each discovered endpoint — a human (or an agent) copies the one they want and runs it directly, or uses the runbook as a checklist of calls to wire into a hand-written FR-CLI-08 scenario themselves.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
Endpoint is one operation an OpenAPI document declares: an HTTP method on a path, with its summary (when the spec provides one) for a human-readable runbook entry.
type Spec ¶
Spec is the minimal slice of an OpenAPI document this package needs: a title for the generated runbook's heading, a base URL to combine with each endpoint's path, and the endpoints themselves.
func Parse ¶
Parse reads an OpenAPI 3.x document from data (JSON only — see this package's doc comment) and returns the Spec RenderRunbook needs.
func (*Spec) RenderRunbook ¶
RenderRunbook renders a Markdown document: one `vegaload run` command per endpoint, ready to copy and run (or for an MCP-driven agent to pass straight to the run_test tool's target/protocol/executor arguments). name is used only in the heading, to connect the runbook back to the scaffold command that produced it.