Documentation
¶
Index ¶
- Variables
- func AddSecuritySchema(id, header, description string)
- func AddTag(name, description string)
- func AddWebhook(wdoc *WebhookDoc)
- func Route(doc *Doc)
- func SchemaInject(s interface{}) openapi3gen.Option
- func SetSchema(new Openapi)
- func Setup()
- type Component
- type Contact
- type Content
- type Doc
- type Info
- type License
- type Openapi
- type Operation
- type Parameter
- type Path
- type ReqBody
- type Response
- type Schema
- type SchemaResp
- type Security
- type Server
- type SetupData
- type Tag
- type WebhookDoc
Constants ¶
This section is empty.
Variables ¶
View Source
var BoolSchema *openapi3.SchemaRef
View Source
var IdSchema *openapi3.SchemaRef
Functions ¶
func AddSecuritySchema ¶
func AddSecuritySchema(id, header, description string)
func AddWebhook ¶
func AddWebhook(wdoc *WebhookDoc)
func SchemaInject ¶
func SchemaInject(s interface{}) openapi3gen.Option
Types ¶
type Doc ¶
type Doc struct {
Method string
Pattern string
OpId string
Summary string
Description string
Params []Parameter
Tags []string
Req any
Resp any
RespName string // Just in case resp cannot be used to derive the name
AuthType []string
}
Highlevel stuff
type Openapi ¶
type Openapi struct {
OpenAPI string `json:"openapi"`
Info Info `json:"info"`
Servers []Server `json:"servers"`
Components Component `json:"components"`
Webhooks *orderedmap.OrderedMap[string, Path] `json:"webhooks,omitempty"`
Paths *orderedmap.OrderedMap[string, Path] `json:"paths"`
Tags []Tag `json:"tags,omitempty"`
}
type Operation ¶
type Operation struct {
Summary string `json:"summary"`
Tags []string `json:"tags,omitempty"`
Description string `json:"description"`
ID string `json:"operationId"`
RequestBody *Schema `json:"requestBody,omitempty"`
Parameters []Parameter `json:"parameters"`
Responses map[string]Response `json:"responses"`
Security []map[string][]string `json:"security,omitempty"`
Servers []Server `json:"servers,omitempty"`
}
type Parameter ¶
type Parameter struct {
Name string `json:"name"`
In string `json:"in"`
Description string `json:"description"`
Required bool `json:"required"`
Schema any `json:"schema"`
}
Parameter defines a openAPI parameter
type Path ¶
type Path struct {
Summary string `json:"summary"` // Danger do not use this
Description string `json:"description"`
Head *Operation `json:"head,omitempty"`
Get *Operation `json:"get,omitempty"`
Post *Operation `json:"post,omitempty"`
Put *Operation `json:"put,omitempty"`
Patch *Operation `json:"patch,omitempty"`
Delete *Operation `json:"delete,omitempty"`
}
type Response ¶
type Response struct {
Description string `json:"description"`
Content map[string]SchemaResp `json:"content"`
}
Represents a openAPI response
type SchemaResp ¶
type SchemaResp struct {
Schema Schema `json:"schema"`
}
Click to show internal directories.
Click to hide internal directories.