Documentation
¶
Overview ¶
Package operation lowers what a document says an API does: its path items, webhooks and callbacks, the parameters merged onto each operation, and the content of every request body, response and header.
It sits above the schema walk, which it reaches for every type position, and above auth, for the requirements an operation names. It reaches nothing above itself: the compiler assembles a Document from what LowerService returns.
The recursion is callbacks, each a path item holding operations of its own, which is why lowerOperation, lowerCallbacks, lowerCallbackOps and mountPathItem cannot be separated. internal/archtest pins that set.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Links ¶
type Links struct {
// contains filtered or unexported fields
}
Links holds the links a service's responses declare until Resolve can read them: a link names an operation that may lower after the response carrying it, and a member of a type the registry may build only once every lowering has returned (docs/compilers/openapi.md#links). Its zero value holds none.
func (*Links) Resolve ¶
Resolve lowers every link l holds onto the response carrying it, now that w, the document, is whole, and registers the server a link names in srv. A link whose target, parameters or values do not all resolve is kept verbatim on that response instead, with the finding that says why: a link is lowered whole or not at all, so no consumer reads one missing a value its source states. c is the source's context.
type Lowered ¶
type Lowered struct {
Service ir.Service
TagDefs []ir.TagDef
Servers map[ir.ServerID]ir.Server
Auth map[ir.AuthID]ir.AuthScheme
Kept ir.Unmodeled
Links Links
}
Lowered is what LowerService builds from one document. Each field is the Document field of its name, bar Service, the one entry of Services, Kept, entries for the Document's Unmodeled, and Links, which Links.Resolve lowers onto Service once the type registry is whole.
func LowerService ¶
func LowerService(ctx context.Context, c lowering.Ctx, ts *compile.Types, declared map[ir.AuthID]ir.AuthScheme) (Lowered, []ir.Diagnostic)
LowerService lowers one document's service, its operations grouped per the configured strategy (docs/ir/services.md), and its declared tags. It returns them beside every server it registers, every scheme in declared with each unresolved one a requirement names, the Document's kept entries and its links.
ctx bounds the walk in time, for the reason LowerComponentSchemas takes one: a document mounts as many paths and webhooks as it likes. Cancellation stops both loops between path items and returns the groups filled so far; the compiler's run sees ctx.Err() at the phase boundary after this and refuses, rather than assembling a Document from them.
Source Files
¶
- callbacks.go
- catchall.go
- content.go
- doc.go
- encoding.go
- examples.go
- filebody.go
- groups.go
- headers.go
- keptonce.go
- linkresolve.go
- links.go
- linkvalues.go
- multipart.go
- operationids.go
- operations.go
- params.go
- partdefault.go
- partfile.go
- partunions.go
- pathitem.go
- pathitemref.go
- pathkeys.go
- recopy.go
- requestbody.go
- responses.go
- sequential.go
- sharedroute.go
- streaming.go
- typespelling.go