Documentation
¶
Overview ¶
Package openapi builds an OpenAPI document from Go types. It has no dependency: a schema reflector over `json` struct tags and a builder that lays out paths, security and a shared error envelope. The output is deterministic (maps are marshalled sorted), so a committed copy of it is a reviewable diff.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Document ¶
type Document struct {
Title, Description, Version string
// Error is the envelope type of every failure; ErrorCodes its machine codes.
Error reflect.Type
ErrorCodes []string
Ops []Operation
}
Document describes the whole API.
type Operation ¶
type Operation struct {
ID, Path, Summary string
// Stability is the tier name, emitted as x-stability.
Stability string
Params []Param
// Response is the type of the 200 body; nil is a free-form object.
Response reflect.Type
// Errors are the HTTP statuses answered with the error envelope.
Errors []int
// Public says no bearer token is needed.
Public bool
// Events makes the operation a server-sent event stream: the 200 body is
// text/event-stream and each event's data has the given type.
Events []Event
}
Operation is one GET operation.