Documentation
¶
Overview ¶
Package openapi turns an OpenAPI 3.0/3.1 document into Flow-I requests: one request per operation (path versions /v1/, /v2/ grouped as request versions), bodies generated from schemas, response schemas kept as the request's contract, and flows suggested from links. It is a pure transform: it returns model values and writes nothing.
libopenapi checks that the input is an OpenAPI 3 document; the mapping works on the decoded document with local $ref resolution (external references are reported, not followed).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrSwagger2 = errors.New("a Swagger 2.0 document cannot take overlays from Flow-I; convert it to OpenAPI 3 first")
ErrSwagger2 is returned by OperationsOf for a Swagger 2.0 document: Import converts it first, so an overlay could not point into it.
Functions ¶
Types ¶
type OperationRef ¶
type OperationRef struct {
RequestPath string // the request Import makes of it
Label string // the version label
Method string // lower case, as in the document
Path string // the path template, as in the document
OperationID string
Op map[string]any // the operation object, references not followed
PathParams []any // the path item's parameters, shared by its operations
}
OperationRef is the operation an imported request version came from, as the document writes it: what a spec overlay needs to point at it.
func OperationsOf ¶
func OperationsOf(data []byte) ([]OperationRef, error)
OperationsOf lists the operations of an OpenAPI 3 document with the request path and version label Import gives each.
type Result ¶
type Result struct {
Requests []model.Request // Path is set (relative to requests/); File is not
// Schemas holds response schemas: request path → version label →
// status code → JSON schema with references inlined.
Schemas map[string]map[string]map[string]any
Flows []model.Flow // suggested from links; Path is relative to flows/
}
Result is what an OpenAPI document becomes.