Documentation
¶
Index ¶
- Variables
- func GetPathFromBuilder(p *PathBuilder) string
- type API
- func (a *API) AddExternalDocs(url, externalDescription string)
- func (a *API) AddPath(method string, pathBuilder *PathBuilder, desc PathDesc) error
- func (a *API) AddServer(url, description string)
- func (a *API) AddTag(name, description string)
- func (a *API) AddTagExternalDocs(name, description string, url, externalDescription string)
- func (a *API) ChiAuthMiddleware(isAllowed func(authName string, scopes []string, r *http.Request) bool) func(next http.Handler) http.Handler
- func (a *API) DefaultResponse(response *MethodResponse)
- func (a *API) Delete(option *Delete) error
- func (a *API) Get(option *Get) error
- func (a *API) GetHandleFunc() []HandlerConfig
- func (a *API) Head(option *Patch) error
- func (a *API) OpenAPIHandlerFunc() (http.HandlerFunc, error)
- func (a *API) Options(option *Options) error
- func (a *API) Patch(option *Patch) error
- func (a *API) Post(option *Post) error
- func (a *API) Print()
- func (a *API) Put(option *Put) error
- func (a *API) ToJSON() ([]byte, error)
- func (a *API) ToYAML() ([]byte, error)
- func (a *API) Trace(option *Trace) error
- func (a *API) Validate() error
- func (a *API) WithApiKey(key string, in InTypes, name string) error
- func (a *API) WithBasicAuth(key string) error
- func (a *API) WithBearerAuth(key, scheme, bearerFormat string) error
- func (a *API) WithOpenIDConnect(key string, openIdConnectUrl string) error
- type ApiKeyAuth
- type BasicAuth
- type BearerAuth
- type Components
- type DataType
- type Delete
- func (m *Delete) GetAuthentication(key string) (bool, []string)
- func (m *Delete) GetDescription() string
- func (m *Delete) GetExtensions() map[string]interface{}
- func (m *Delete) GetHandlerFunc() http.HandlerFunc
- func (m *Delete) GetHeaders() []Parameter
- func (m *Delete) GetOperationID() string
- func (m *Delete) GetRequestBodies() *RequestBodies
- func (m *Delete) GetResponse(s string) (string, interface{})
- func (m *Delete) GetSummary() string
- func (m *Delete) GetTags() []string
- type Enum
- type Extensions
- type ExternalDocs
- type FileUpload
- type GenericParameter
- type Get
- func (m *Get) GetAuthentication(key string) (bool, []string)
- func (m *Get) GetDescription() string
- func (m *Get) GetExtensions() map[string]interface{}
- func (m *Get) GetHandlerFunc() http.HandlerFunc
- func (m *Get) GetHeaders() []Parameter
- func (m *Get) GetOperationID() string
- func (m *Get) GetRequestBodies() *RequestBodies
- func (m *Get) GetResponse(s string) (string, interface{})
- func (m *Get) GetSummary() string
- func (m *Get) GetTags() []string
- type GetDescription
- type HandlerConfig
- type Head
- func (m *Head) GetAuthentication(key string) (bool, []string)
- func (m *Head) GetDescription() string
- func (m *Head) GetExtensions() map[string]interface{}
- func (m *Head) GetHandlerFunc() http.HandlerFunc
- func (m *Head) GetHeaders() []Parameter
- func (m *Head) GetOperationID() string
- func (m *Head) GetRequestBodies() *RequestBodies
- func (m *Head) GetResponse(s string) (string, interface{})
- func (m *Head) GetSummary() string
- func (m *Head) GetTags() []string
- type InTypes
- type Info
- type MediaType
- type MethodResponse
- type OpenAPI
- type OpenIDConnectAuth
- type Operation
- type Options
- func (m *Options) GetAuthentication(key string) (bool, []string)
- func (m *Options) GetDescription() string
- func (m *Options) GetExtensions() map[string]interface{}
- func (m *Options) GetHandlerFunc() http.HandlerFunc
- func (m *Options) GetHeaders() []Parameter
- func (m *Options) GetOperationID() string
- func (m *Options) GetRequestBodies() *RequestBodies
- func (m *Options) GetResponse(s string) (string, interface{})
- func (m *Options) GetSummary() string
- func (m *Options) GetTags() []string
- type Parameter
- type ParameterListOption
- type Patch
- func (m *Patch) GetAuthentication(key string) (bool, []string)
- func (m *Patch) GetDescription() string
- func (m *Patch) GetExtensions() map[string]interface{}
- func (m *Patch) GetHandlerFunc() http.HandlerFunc
- func (m *Patch) GetHeaders() []Parameter
- func (m *Patch) GetOperationID() string
- func (m *Patch) GetRequestBodies() *RequestBodies
- func (m *Patch) GetResponse(s string) (string, interface{})
- func (m *Patch) GetSummary() string
- func (m *Patch) GetTags() []string
- type PathBuilder
- func (p *PathBuilder) Add(segment string) *PathBuilder
- func (p *PathBuilder) AddParameter(name string, t TYPE, description string) *PathBuilder
- func (p *PathBuilder) AddParameterList(name string, t TYPE, description string, option *ParameterListOption) *PathBuilder
- func (p *PathBuilder) WithQueryParameter(name string, t TYPE, description string, required bool) *PathBuilder
- func (p *PathBuilder) WithQueryParameterList(name string, t TYPE, description string, required bool, ...) *PathBuilder
- type PathDesc
- type PathItem
- type Post
- func (m *Post) GetAuthentication(key string) (bool, []string)
- func (m *Post) GetDescription() string
- func (m *Post) GetExtensions() map[string]interface{}
- func (m *Post) GetHandlerFunc() http.HandlerFunc
- func (m *Post) GetHeaders() []Parameter
- func (m *Post) GetOperationID() string
- func (m *Post) GetRequestBodies() *RequestBodies
- func (m *Post) GetResponse(s string) (string, interface{})
- func (m *Post) GetSummary() string
- func (m *Post) GetTags() []string
- type Put
- func (m *Put) GetAuthentication(key string) (bool, []string)
- func (m *Put) GetDescription() string
- func (m *Put) GetExtensions() map[string]interface{}
- func (m *Put) GetHandlerFunc() http.HandlerFunc
- func (m *Put) GetHeaders() []Parameter
- func (m *Put) GetOperationID() string
- func (m *Put) GetRequestBodies() *RequestBodies
- func (m *Put) GetResponse(s string) (string, interface{})
- func (m *Put) GetSummary() string
- func (m *Put) GetTags() []string
- type RefValue
- type RequestBodies
- type RequestBody
- type Response
- type Schema
- type SchemaRef
- type SchemaRefs
- type Schemas
- type Server
- type Style
- type TYPE
- type Tag
- type Trace
- func (m *Trace) GetAuthentication(key string) (bool, []string)
- func (m *Trace) GetDescription() string
- func (m *Trace) GetExtensions() map[string]interface{}
- func (m *Trace) GetHandlerFunc() http.HandlerFunc
- func (m *Trace) GetHeaders() []Parameter
- func (m *Trace) GetOperationID() string
- func (m *Trace) GetRequestBodies() *RequestBodies
- func (m *Trace) GetResponse(s string) (string, interface{})
- func (m *Trace) GetSummary() string
- func (m *Trace) GetTags() []string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( INTEGER = TYPE{ Type: "integer", } //INT32 signed 32 bits INT32 = TYPE{ Type: "integer", Format: "int32", } //INT64 signed 64 bits (a.k.a long) INT64 = TYPE{ Type: "integer", Format: "int64", } FLOAT = TYPE{ Type: "number", Format: "float", } DOUBLE = TYPE{ Type: "number", Format: "double", } STRING = TYPE{ Type: "string", } BOOLEAN = TYPE{ Type: "boolean", } //BINARY any sequence of octets BINARY = TYPE{ Type: "string", Format: "binary", } //BYTE base64 encoded characters BYTE = TYPE{ Type: "string", Format: "byte", } //DATE As defined by full-date - RFC3339 DATE = TYPE{ Type: "string", Format: "date", } //DATETIME As defined by date-time - RFC3339 DATETIME = TYPE{ Type: "string", Format: "date-time", } //PASSWORD A hint to UIs to obscure input. PASSWORD = TYPE{ Type: "string", Format: "password", } )
Functions ¶
func GetPathFromBuilder ¶
func GetPathFromBuilder(p *PathBuilder) string
Types ¶
type API ¶
type API struct { OpenAPI // contains filtered or unexported fields }
func NewOpenAPI ¶
func NewOpenAPI() *API
func (*API) AddExternalDocs ¶
func (*API) AddPath ¶
func (a *API) AddPath(method string, pathBuilder *PathBuilder, desc PathDesc) error
func (*API) AddTagExternalDocs ¶
func (*API) ChiAuthMiddleware ¶
func (*API) DefaultResponse ¶
func (a *API) DefaultResponse(response *MethodResponse)
func (*API) GetHandleFunc ¶
func (a *API) GetHandleFunc() []HandlerConfig
func (*API) OpenAPIHandlerFunc ¶
func (a *API) OpenAPIHandlerFunc() (http.HandlerFunc, error)
func (*API) WithBasicAuth ¶
func (*API) WithBearerAuth ¶
type ApiKeyAuth ¶
type BearerAuth ¶
type Components ¶
type Delete ¶
type Delete struct { Summary string Description string OperationID string Tags []string Authentication map[string][]string Response map[string]MethodResponse Path *PathBuilder Headers []Parameter Extensions http.HandlerFunc }
func (*Delete) GetDescription ¶
func (*Delete) GetExtensions ¶ added in v0.3.0
func (*Delete) GetHandlerFunc ¶
func (m *Delete) GetHandlerFunc() http.HandlerFunc
func (*Delete) GetHeaders ¶
func (*Delete) GetOperationID ¶
func (*Delete) GetRequestBodies ¶ added in v0.2.0
func (m *Delete) GetRequestBodies() *RequestBodies
func (*Delete) GetResponse ¶
func (*Delete) GetSummary ¶
type Extensions ¶ added in v0.3.0
type Extensions map[string]interface{}
type ExternalDocs ¶
type FileUpload ¶ added in v0.2.0
type FileUpload string
const ( FileUploadBinary FileUpload = "binary" FileUploadBase64 FileUpload = "base64" )
type GenericParameter ¶
type GenericParameter struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` In string `json:"in,omitempty" yaml:"in,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"` Required bool `json:"required,omitempty" yaml:"required,omitempty"` Example interface{} `json:"example,omitempty" yaml:"example,omitempty"` Schema *SchemaRef `json:"schema,omitempty" yaml:"schema,omitempty"` }
type Get ¶
type Get struct { Summary string Description string OperationID string Tags []string Authentication map[string][]string Response map[string]MethodResponse Path *PathBuilder Headers []Parameter Extensions http.HandlerFunc }
func (*Get) GetDescription ¶
func (*Get) GetExtensions ¶ added in v0.3.0
func (*Get) GetHandlerFunc ¶
func (m *Get) GetHandlerFunc() http.HandlerFunc
func (*Get) GetHeaders ¶
func (*Get) GetOperationID ¶
func (*Get) GetRequestBodies ¶ added in v0.2.0
func (m *Get) GetRequestBodies() *RequestBodies
func (*Get) GetResponse ¶
func (*Get) GetSummary ¶
type GetDescription ¶
type GetDescription interface {
GetDescription() string
}
type HandlerConfig ¶
type Head ¶
type Head struct { Summary string Description string OperationID string Tags []string Authentication map[string][]string Path *PathBuilder Headers []Parameter Extensions http.HandlerFunc }
func (*Head) GetDescription ¶
func (*Head) GetExtensions ¶ added in v0.3.0
func (*Head) GetHandlerFunc ¶
func (m *Head) GetHandlerFunc() http.HandlerFunc
func (*Head) GetHeaders ¶
func (*Head) GetOperationID ¶
func (*Head) GetRequestBodies ¶ added in v0.2.0
func (m *Head) GetRequestBodies() *RequestBodies
func (*Head) GetResponse ¶
func (*Head) GetSummary ¶
type Info ¶
type Info struct { Title string `json:"title" yaml:"title" validate:"required"` Description string `json:"description,omitempty" yaml:"description,omitempty"` TermsOfService string `json:"termsOfService,omitempty" yaml:"termsOfService,omitempty"` //Contact *Contact `json:"contact,omitempty" yaml:"contact,omitempty"` //License *License `json:"license,omitempty" yaml:"license,omitempty"` Version string `json:"version" yaml:"version" validate:"required"` // Required }
type MediaType ¶
type MediaType struct { Schema interface{} `json:"schema,omitempty" yaml:"schema,omitempty"` Example interface{} `json:"example,omitempty" yaml:"example,omitempty"` }
type MethodResponse ¶
type MethodResponse struct { Description string Value interface{} }
type OpenAPI ¶
type OpenAPI struct { OpenAPI string `json:"openapi" yaml:"openapi" validate:"required"` Info `json:"info" yaml:"info" validate:"required"` Servers []*Server `json:"servers,omitempty" yaml:"servers,omitempty"` Paths map[string]*PathItem `json:"paths" yaml:"paths" validate:"required"` Components *Components `json:"components" yaml:"components"` Tags []*Tag `json:"tags,omitempty" yaml:"tags,omitempty"` ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` }
type OpenIDConnectAuth ¶
type Operation ¶
type Operation struct { Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"` Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` OperationID string `json:"operationId,omitempty" yaml:"operationId,omitempty"` Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"` Responses map[string]*Response `json:"responses" yaml:"responses" validate:"required"` Security []map[string][]string `json:"security,omitempty" yaml:"security,omitempty"` RequestBody *RequestBody `json:"requestBody,omitempty" yaml:"requestBody,omitempty"` Parameters []GenericParameter `json:"parameters,omitempty" yaml:"parameters,omitempty"` // contains filtered or unexported fields }
func (*Operation) MarshalJSON ¶ added in v0.3.0
type Options ¶
type Options struct { Summary string Description string OperationID string Tags []string Authentication map[string][]string Response map[string]MethodResponse Path *PathBuilder Headers []Parameter Extensions http.HandlerFunc }
func (*Options) GetAuthentication ¶
func (*Options) GetDescription ¶
func (*Options) GetExtensions ¶ added in v0.3.0
func (*Options) GetHandlerFunc ¶
func (m *Options) GetHandlerFunc() http.HandlerFunc
func (*Options) GetHeaders ¶
func (*Options) GetOperationID ¶
func (*Options) GetRequestBodies ¶ added in v0.2.0
func (m *Options) GetRequestBodies() *RequestBodies
func (*Options) GetResponse ¶
func (*Options) GetSummary ¶
type ParameterListOption ¶ added in v0.1.0
type Patch ¶
type Patch struct { Summary string Description string OperationID string Tags []string Authentication map[string][]string Response map[string]MethodResponse Path *PathBuilder Headers []Parameter // Deprecated: Please migrate to RequestBodies RequestBody interface{} RequestBodies *RequestBodies Extensions http.HandlerFunc }
func (*Patch) GetDescription ¶
func (*Patch) GetExtensions ¶ added in v0.3.0
func (*Patch) GetHandlerFunc ¶
func (m *Patch) GetHandlerFunc() http.HandlerFunc
func (*Patch) GetHeaders ¶
func (*Patch) GetOperationID ¶
func (*Patch) GetRequestBodies ¶ added in v0.2.0
func (m *Patch) GetRequestBodies() *RequestBodies
func (*Patch) GetResponse ¶
func (*Patch) GetSummary ¶
type PathBuilder ¶
type PathBuilder struct {
// contains filtered or unexported fields
}
func NewPathBuilder ¶
func NewPathBuilder() *PathBuilder
func (*PathBuilder) Add ¶
func (p *PathBuilder) Add(segment string) *PathBuilder
func (*PathBuilder) AddParameter ¶
func (p *PathBuilder) AddParameter(name string, t TYPE, description string) *PathBuilder
func (*PathBuilder) AddParameterList ¶ added in v0.1.0
func (p *PathBuilder) AddParameterList(name string, t TYPE, description string, option *ParameterListOption) *PathBuilder
func (*PathBuilder) WithQueryParameter ¶
func (p *PathBuilder) WithQueryParameter(name string, t TYPE, description string, required bool) *PathBuilder
func (*PathBuilder) WithQueryParameterList ¶ added in v0.1.0
func (p *PathBuilder) WithQueryParameterList(name string, t TYPE, description string, required bool, option *ParameterListOption) *PathBuilder
type PathDesc ¶
type PathDesc interface { GetSummary() string GetOperationID() string GetDescription GetResponse(string) (string, interface{}) GetAuthentication(key string) (bool, []string) GetHeaders() []Parameter GetRequestBodies() *RequestBodies GetExtensions() map[string]interface{} GetTags() []string GetHandlerFunc() http.HandlerFunc }
type PathItem ¶
type PathItem struct { Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Get *Operation `json:"get,omitempty" yaml:"get,omitempty"` Connect *Operation `json:"connect,omitempty" yaml:"connect,omitempty"` Delete *Operation `json:"delete,omitempty" yaml:"delete,omitempty"` Head *Operation `json:"head,omitempty" yaml:"head,omitempty"` Options *Operation `json:"options,omitempty" yaml:"options,omitempty"` Patch *Operation `json:"patch,omitempty" yaml:"patch,omitempty"` Post *Operation `json:"post,omitempty" yaml:"post,omitempty"` Put *Operation `json:"put,omitempty" yaml:"put,omitempty"` Trace *Operation `json:"trace,omitempty" yaml:"trace,omitempty"` }
type Post ¶
type Post struct { Summary string Description string OperationID string Tags []string Authentication map[string][]string Response map[string]MethodResponse Path *PathBuilder Headers []Parameter // Deprecated: Please migrate to RequestBodies RequestBody interface{} RequestBodies *RequestBodies Extensions http.HandlerFunc }
func (*Post) GetDescription ¶
func (*Post) GetExtensions ¶ added in v0.3.0
func (*Post) GetHandlerFunc ¶
func (m *Post) GetHandlerFunc() http.HandlerFunc
func (*Post) GetHeaders ¶
func (*Post) GetOperationID ¶
func (*Post) GetRequestBodies ¶ added in v0.2.0
func (m *Post) GetRequestBodies() *RequestBodies
func (*Post) GetResponse ¶
func (*Post) GetSummary ¶
type Put ¶
type Put struct { Summary string Description string OperationID string Tags []string Authentication map[string][]string Response map[string]MethodResponse Path *PathBuilder Headers []Parameter // Deprecated: Please migrate to RequestBodies RequestBody interface{} RequestBodies *RequestBodies Extensions http.HandlerFunc }
func (*Put) GetDescription ¶
func (*Put) GetExtensions ¶ added in v0.3.0
func (*Put) GetHandlerFunc ¶
func (m *Put) GetHandlerFunc() http.HandlerFunc
func (*Put) GetHeaders ¶
func (*Put) GetOperationID ¶
func (*Put) GetRequestBodies ¶ added in v0.2.0
func (m *Put) GetRequestBodies() *RequestBodies
func (*Put) GetResponse ¶
func (*Put) GetSummary ¶
type RefValue ¶
type RefValue struct { Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"` Value interface{} `json:"value,omitempty" yaml:"value,omitempty"` }
type RequestBodies ¶ added in v0.2.0
type RequestBody ¶
type Schema ¶
type Schema struct { Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"` Value interface{} `json:"value,omitempty" yaml:"value,omitempty"` Type string `json:"type,omitempty" yaml:"type,omitempty"` Format string `json:"format,omitempty" yaml:"format,omitempty"` Enum []string `json:"enum,omitempty" yaml:"enum,omitempty"` Items *Schema `json:"items,omitempty" yaml:"items,omitempty"` }
type SchemaRef ¶
type SchemaRef struct { Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"` Value interface{} `json:"value,omitempty" yaml:"value,omitempty"` }
func (*SchemaRef) MarshalJSON ¶
func (*SchemaRef) UnmarshalJSON ¶
type SchemaRefs ¶
type SchemaRefs []*SchemaRef
type Tag ¶
type Tag struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` }
type Trace ¶
type Trace struct { Summary string Description string OperationID string Tags []string Authentication map[string][]string Path *PathBuilder Headers []Parameter Extensions http.HandlerFunc }
func (*Trace) GetDescription ¶
func (*Trace) GetExtensions ¶ added in v0.3.0
func (*Trace) GetHandlerFunc ¶
func (m *Trace) GetHandlerFunc() http.HandlerFunc
func (*Trace) GetHeaders ¶
func (*Trace) GetOperationID ¶
func (*Trace) GetRequestBodies ¶ added in v0.2.0
func (m *Trace) GetRequestBodies() *RequestBodies
func (*Trace) GetResponse ¶
func (*Trace) GetSummary ¶
Click to show internal directories.
Click to hide internal directories.