Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMissingEncoder = errors.New("missing encoder")
View Source
var ErrUnknownLanguage = errors.New("language is not known")
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
type Endpoint struct {
HTTPVerb string
Path string
OpenAPI struct {
Operation *openapi3.Operation
PathItem *openapi3.PathItem
Document *openapi3.T
}
}
Endpoint defines a openapi operation and meta information for templating
type Language ¶
type Language interface {
GetAdditionals(data *TemplateData) map[string]interface{} // Allows the language to set additional data to the template data
GetTemplate() (*template.Template, error) // Must return the template for the code sample
Name() string
}
Language defines an interface for each language to be used with the templater
type TemplateData ¶
type TemplateData struct {
Parameters *types.Parameters // Different parameter types
SecurityParameters *types.Parameters // Security related parameters (authentication), their value is either "${TOKEN}" or "Bearer ${TOKEN}"
Path string // Example path
QueryParamsString string // Example query params as urlencoded string
URL string // Example URL
HTTPVerb string // HTTP Method
Body interface{} // The body as golang data type
BodyString string // The body formatted in the endpoints "accept" format Meta *types.FormattingMeta
BasicAuth bool // True if basic Auth is enabled
Additionals map[string]interface{} // Language specific data
Formatting *types.FormattingMeta // Metadata about the format used
}
TemplateData holds all data available in templating
Click to show internal directories.
Click to hide internal directories.