Documentation
¶
Overview ¶
Package servers lowers the servers a document declares, whichever object declares them, into one registry keyed by ID, and names the ones a scope uses (docs/compilers/openapi.md#servers, docs/compilers/openapi.md#path-item-servers).
It is its own package because the service walk and the operation walk both reach it: the first lowers the document's own list, the second a path item's and an operation's, each into the Registry the compiler's run assigns to Document.Servers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is every server lowered so far, keyed by ID, for one compile. A declaration is lowered once: a path item two paths mount registers its servers at the first mount and names the same IDs at the second, reporting nothing twice. The zero value is not usable; NewRegistry builds one.
func (*Registry) Declared ¶
func (r *Registry) Declared(c lowering.Ctx, list []*soa.Server, owner jsontext.Pointer) ([]ir.ServerID, []ir.Diagnostic)
Declared registers the servers list the object at owner declares and returns their IDs in source order, or nil when it lowers none. c is the context of the document that declares the list, so each server's ID and provenance name its own position there, whichever mount reached it.
A nil entry, which no valid document writes, lowers nothing and keeps the index it occupies, so the next entry's ID is still its own position. An empty list declares nothing, as an absent one does: whether it should override the list above it is undecided (GitHub #1081).
func (*Registry) Root ¶
Root registers the document's own servers and returns their IDs in source order: the servers its service is sent to. A document whose servers field is absent or empty is served at "/", which OpenAPI supplies in its place and which is minted at ids.DefaultServer with no pointer, since nothing in the source writes it (GitHub #672).