Documentation
¶
Overview ¶
Package openapi loads and normalizes an OpenAPI 3 document into a model that the SpecRiot engine can execute. Only the information needed for generation and execution is retained.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEmptySpec = errors.New("openapi: document contains no operations")
ErrEmptySpec is returned when a document contains no operations.
Functions ¶
func MethodRank ¶
MethodRank maps an HTTP method to a stable ordering rank.
Types ¶
type Operation ¶
type Operation struct {
Method string
Path string
OperationID string
Summary string
Description string
Tags []string
Parameters []*Parameter
RequestBody *RequestBody
Responses []*Response
}
Operation is a normalized, executable HTTP operation.
type Parameter ¶
type Parameter struct {
Name string
In string // "path", "query", "header", "cookie"
Required bool
Schema *schema.Schema
}
Parameter describes a request parameter in one of the standard locations.
type RequestBody ¶
RequestBody describes the request body of an operation.
type Spec ¶
type Spec struct {
OpenAPI string
Title string
Version string
Description string
Servers []string
Operations []*Operation
}
Spec is a normalized OpenAPI document.
func LoadFile ¶
LoadFile parses and normalizes an OpenAPI 3 document from a file path. Local $refs are resolved during loading.
func (*Spec) SortedOperations ¶
SortedOperations returns operations sorted by (path, method) for a deterministic execution order. Methods follow a fixed rank rather than lexicographic order: get, put, post, delete, options, head, patch, trace.