Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Component ¶
type Component struct {
SecurityScheme sync.Map[string, *SecurityScheme] `json:"securitySchemes"`
Parameters map[string]*Parameter `json:"parameters,omitempty"`
Schemas map[string]*Schema `json:"schemas,omitempty"`
}
func (*Component) AddSecurityScheme ¶
func (this *Component) AddSecurityScheme(name string) *SecurityScheme
type PathItem ¶
type PathItem struct {
Summary string `json:"summary"` // this is more like a Name
Description string `json:"description"` // displayed on the right
RequestBody *RequestBody `json:"requestBody,omitempty"`
Servers []Server `json:"servers,omitempty"`
Responses map[string]Response `json:"responses"` // "default", "200", ...
Security Securities `json:"security,omitempty"`
Deprecated bool `json:"deprecated,omitempty"`
Parameters []Parameter `json:"parameters,omitempty"`
}
type RequestBody ¶
type Schema ¶
type Schema struct {
Type string `json:"type,omitempty"` // object/string/integer
Format string `json:"format,omitempty"` // int64
Required []string `json:"required,omitempty"` // list of required fields names
Properties map[string]*Schema `json:"properties,omitempty"` // for structs
AdditionalProps *Schema `json:"additionalProperties,omitempty"` // for maps
Description string `json:"description,omitempty"`
Example string `json:"example,omitempty"`
Items *Schema `json:"items,omitempty"` // for arrays/slices
Default string `json:"default,omitempty"`
Enum []string `json:"enum,omitempty"`
// Mutually exclusive (if you have a $ref, it will overwrite anything else)
// See https://swagger.io/docs/specification/using-ref/
Reference string `json:"$ref,omitempty"`
}
type Securities ¶
type Securities []Security
func (*Securities) Append ¶
func (this *Securities) Append(s Security)
type SecurityScheme ¶
type SecurityScheme struct {
Type string `json:"type"` // apiKey, http, mutualTLS, oauth2, openIdConnect
Description string `json:"description"`
// http
Scheme string `json:"scheme,omitempty"` // Bearer (https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml)
BearerFormat string `json:"bearerFormat,omitempty"` // likely JWT
// apiKey
In string `json:"in,omitempty"` // query, header, cookie
Name string `json:"name,omitempty"`
}
func (*SecurityScheme) SetJWT ¶
func (this *SecurityScheme) SetJWT()
type Service ¶
type Service struct {
OpenAPI string `json:"openapi"` // should be 3.0.0
Info struct {
Version string `json:"version,omitempty"`
Title string `json:"title,omitempty"`
License struct {
Name string `json:"name,omitempty"`
} `json:"license,omitempty"`
} `json:"info"`
Paths map[string]*Path `json:"paths"`
Components Component `json:"components"`
}
func NewService ¶
Click to show internal directories.
Click to hide internal directories.