Documentation
¶
Index ¶
- Constants
- type Components
- type Contact
- type Encoding
- type Example
- type ExternalDoc
- type Header
- type Info
- type License
- type Link
- type MediaType
- type OAuthFlow
- type OpenAPI
- func (oa *OpenAPI) ApiURL(path string) string
- func (oa *OpenAPI) AuthApiKey(header string, value string)
- func (oa *OpenAPI) Do(base PathItem, op Operation)
- func (oa *OpenAPI) FirstServer() *Server
- func (oa *OpenAPI) Prepare(method string, path string, data []byte, params map[string]string, ...) *http.Request
- type OpenAPIBuilder
- type Operation
- type Parameter
- type PathItem
- type RequestBody
- type Response
- type Responses
- type Schema
- type SecurityRequirement
- type SecurityScheme
- type Server
- type ServerVariable
Constants ¶
View Source
const (
ContentTypeJson = "application/json"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Components ¶
type Components struct {
Schemas map[string]Schema `json:"schemas,omitempty"`
SecuritySchemes map[string]SecurityScheme `json:"securitySchemes,omitempty"`
}
type ExternalDoc ¶
type ExternalDoc struct {
}
type Info ¶
type Link ¶
type Link struct {
OperationRef string `json:"operationRef,omitempty"`
OperationId string `json:"operationId,omitempty"`
Parameters map[string]interface{} `json:"parameters,omitempty"`
RequestBody interface{} `json:"requestBody,omitempty"`
Description string `json:"description,omitempty"`
Server Server `json:"server,omitempty"`
}
type OpenAPI ¶
type OpenAPI struct {
OpenAPI string `json:"openapi,omitempty"`
Info *Info `json:"info,omitempty"`
Servers []*Server `json:"servers,omitempty"`
Paths map[string]*PathItem `json:"paths,omitempty"`
Components Components `json:"components,omitempty"`
Security []SecurityRequirement `json:"security,omitempty"`
// Not in OpenAPI spec
Client *http.Client `json:"-"`
ApiKey *SecurityScheme `json:"-"`
}
func (*OpenAPI) AuthApiKey ¶
func (*OpenAPI) FirstServer ¶
type OpenAPIBuilder ¶
type OpenAPIBuilder struct {
OpenAPI *OpenAPI
// contains filtered or unexported fields
}
type Operation ¶
type Operation struct {
Tags []string `json:"tags,omitempty"`
Summary string `json:"summary,omitempty"`
Description string `json:"description,omitempty"`
ExternalDocs *ExternalDoc `json:"externalDocs,omitempty"`
OperationId string `json:"operationId,omitempty"`
Parameters []*Parameter `json:"parameters,omitempty"`
RequestBody *RequestBody `json:"requestBody,omitempty"`
Responses Responses `json:"responses,omitempty"`
//Callbacks Callback
Deprecated bool `json:"deprecated,omitempty"`
Security SecurityRequirement `json:"security,omitempty"`
Servers []Server `json:"servers,omitempty"`
// Not OpenAPI standard
Method string `json:"-"`
Output interface{} `json:"-"`
}
type Parameter ¶
type Parameter struct {
Name string `json:"name,omitempty"`
In string `json:"in,omitempty"`
Description string `json:"description,omitempty"`
Required bool `json:"required"`
Deprecated bool `json:"deprecated,omitempty"`
AllowEmptyValue bool `json:"allowEmptyValue"`
Schema *Schema `json:"schema,omitempty"`
// Not OpenAPI standard
Value string `json:"-"`
// contains filtered or unexported fields
}
func PathParameter ¶
func QueryParameter ¶
type PathItem ¶
type PathItem struct {
Ref string `json:"$ref,omitempty"`
Summary string `json:"summary,omitempty"`
Description string `json:"description,omitempty"`
Get *Operation `json:"get,omitempty"`
Put *Operation `json:"put,omitempty"`
Post *Operation `json:"post,omitempty"`
Delete *Operation `json:"delete,omitempty"`
Options *Operation `json:"options,omitempty"`
Head *Operation `json:"head,omitempty"`
Patch *Operation `json:"patch,omitempty"`
Trace *Operation `json:"trace,omitempty"`
Servers []Server `json:"servers,omitempty"`
Parameters []Parameter `json:"parameters,omitempty"`
// Not OpenAPI standard
Value string `json:"-"`
}
type RequestBody ¶
type RequestBody struct {
Description string `json:"description,omitempty"`
Content map[string]MediaType `json:"content,omitempty"`
Required bool `json:"required,omitempty"`
}
func JsonRequestBody ¶
func JsonRequestBody(desc string, data interface{}, required bool) *RequestBody
func MakeRequestBody ¶
func MakeRequestBody(desc, contentType string, data interface{}, required bool) *RequestBody
func (*RequestBody) ContentBytes ¶
func (r *RequestBody) ContentBytes() (b []byte, err error)
type Schema ¶
type Schema struct {
Type string `json:"type,omitempty"`
Format string `json:"format,omitempty"`
Properties map[string]*Schema `json:"properties,omitempty"`
Items *Schema `json:"items,omitempty"`
}
func SchemaFrom ¶
func SchemaFromString ¶
type SecurityRequirement ¶
type SecurityScheme ¶
type SecurityScheme struct {
Type string `json:"type,omitempty"`
Description string `json:"description,omitempty"`
Name string `json:"name,omitempty"`
In string `json:"in,omitempty"`
Scheme string `json:"scheme,omitempty"`
BearerFormat string `json:"bearerFormat,omitempty"`
Flows *OAuthFlow `json:"flows,omitempty"`
OpenIdConnectUrl string `json:"openIdConnect_url,omitempty"`
// Not in OpenAPI spec but here for easier integration
Value string `json:"-"`
}
type Server ¶
type Server struct {
URL string `json:"url,omitempty"`
Description string `json:"description,omitempty"`
Variables map[string]ServerVariable `json:"variables,omitempty"`
}
type ServerVariable ¶
Click to show internal directories.
Click to hide internal directories.