Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Implementation ¶
type Implementation struct {
// The input type.
//
// This MUST be a struct or zero.
//
// It MUST NOT contain fields other than
// - Path
// - Query
// - Body
// - Header
Input reflect.Type
Verb string
Path string
Security []security.Requirement
Summary string
Description *string
ExternalDocs *doc.External
Responses response.Implementation
Deprecated bool
}
User-provided metadata containing information on the implementation to be converted to OpenAPI spec.
type Spec ¶
type Spec struct {
// Short summary.
Summary string `json:"summary"`
// Longer description. May include Markdown.
Description *string `json:"description,omitempty"`
// Additional external documentations.
ExternalDocs *doc.External `json:"externalDocs,omitempty"`
// Unique id, case sensitive.
OperationId string `json:"operationId"`
// A declaration of which security mechanisms can be used for this operation. The list of values includes alternative Security Requirement Objects that can be used. Only one of the Security Requirement Objects need to be satisfied to authorize a request. To make security optional, an empty security requirement ({}) can be included in the array. This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used.
SecurityRequirements []security.Requirement `json:"security,omitempty"`
// A list of parameters that are applicable for this operation. If a parameter is already defined at the Path Item, the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and location. The list can use the Reference Object to link to parameters that are defined in the OpenAPI Object’s components.parameters.
Parameters []parameter.Parameter `json:"parameters,omitempty"`
// The body expected by this operation.
Request *request.Request `json:"requestBody,omitempty"`
// The responses that this operation may return.
Responses response.Responses `json:"responses"`
// If true, this endpoint is deprecated.
Deprecated bool `json:"deprecated,omitempty"`
}
func FromImplementation ¶
func FromImplementation(impl Implementation) (Spec, error)
Extract an OpenAPI spec for an operation from a description of the implementation.
Click to show internal directories.
Click to hide internal directories.