Documentation ¶
Index ¶
- func Escape(token string) string
- func GetCanonicalTypeName(val interface{}) string
- func ToRESTFriendlyName(name string) string
- func Unescape(token string) string
- type AllOfExposer
- type AnyOfExposer
- type Config
- type Contact
- type ElseExposer
- type Enum
- type IfExposer
- type License
- type NamedEnum
- type NotExposer
- type OneOfExposer
- type Operation
- func (op *Operation) AddResponse(name string, resp interface{}) *Operation
- func (op *Operation) AddSecurity(security ...security.Security) *Operation
- func (op *Operation) Openapi(item *openapi3.PathItem)
- func (op *Operation) SetDescription(description string) *Operation
- func (op *Operation) SetExclude(exclude bool) *Operation
- func (op *Operation) SetModel(req, rsp interface{}) *Operation
- func (op *Operation) SetOperation(operationID string) *Operation
- func (op *Operation) SetPath(path string) *Operation
- func (op *Operation) SetSummary(summary string) *Operation
- type Server
- type Servers
- type Service
- func (s *Service) AddContentType(contentType ...string) *Service
- func (s *Service) AddSecurity(security ...security.Security) *Service
- func (s *Service) DeleteOf(cb func(op *Operation)) *Service
- func (s *Service) GetOf(cb func(op *Operation)) *Service
- func (s *Service) Openapi() map[string]*openapi3.PathItem
- func (s *Service) PatchOf(cb func(op *Operation)) *Service
- func (s *Service) PostOf(cb func(op *Operation)) *Service
- func (s *Service) PutOf(cb func(op *Operation)) *Service
- func (s *Service) SetName(name string) *Service
- func (s *Service) SetPrefix(prefix string) *Service
- type Swagger
- func (s *Swagger) InitRouter(r *http.ServeMux)
- func (s *Swagger) MarshalJSON() ([]byte, error)
- func (s *Swagger) MarshalYAML() ([]byte, error)
- func (s *Swagger) OpenapiDataHandler() http.HandlerFunc
- func (s *Swagger) ServiceOf(name string, cb func(srv *Service))
- func (s *Swagger) SetRootPath(path string)
- func (s *Swagger) WithService() *Service
- type ThenExposer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCanonicalTypeName ¶ added in v0.0.5
func GetCanonicalTypeName(val interface{}) string
func ToRESTFriendlyName ¶ added in v0.0.5
ToRESTFriendlyName converts Golang package/type canonical name into REST friendly OpenAPI name.
Examples of REST friendly OpenAPI name:
Input: k8s.io/api/core/v1.Pod Output: io.k8s.api.core.v1.Pod Input: k8s.io/api/core/v1 Output: io.k8s.api.core.v1 Input: csi.storage.k8s.io/v1alpha1.CSINodeInfo Output: io.k8s.storage.csi.v1alpha1.CSINodeInfo
Copy from k8s.io/kube-openapi
Types ¶
type AllOfExposer ¶ added in v0.0.4
type AllOfExposer interface {
JSONSchemaAllOf() []interface{}
}
AllOfExposer exposes "allOf" items as list of samples.
type AnyOfExposer ¶ added in v0.0.4
type AnyOfExposer interface {
JSONSchemaAnyOf() []interface{}
}
AnyOfExposer exposes "anyOf" items as list of samples.
type Config ¶
type Config struct { Title string `yaml:"title"` OpenapiRouter string `yaml:"path"` OpenapiRedocRouter string `yaml:"redoc-path"` OpenapiRApiDocRouter string `yaml:"rapidoc-path"` OpenapiUrl string `yaml:"openapi-path"` OpenapiOpt map[string]interface{} `yaml:"options"` }
func DefaultCfg ¶
func DefaultCfg() *Config
type ElseExposer ¶ added in v0.0.4
type ElseExposer interface {
JSONSchemaElse() interface{}
}
ElseExposer exposes "else" schema as a sample.
type Enum ¶ added in v0.0.4
type Enum interface {
Enum() []interface{}
}
Enum returns the enumerated acceptable values.
type IfExposer ¶ added in v0.0.4
type IfExposer interface {
JSONSchemaIf() interface{}
}
IfExposer exposes "if" schema as a sample.
type NamedEnum ¶ added in v0.0.4
type NamedEnum interface {
NamedEnum() ([]interface{}, []string)
}
NamedEnum returns the enumerated acceptable values with according string names.
type NotExposer ¶ added in v0.0.4
type NotExposer interface {
JSONSchemaNot() interface{}
}
NotExposer exposes "not" schema as a sample.
type OneOfExposer ¶ added in v0.0.4
type OneOfExposer interface {
JSONSchemaOneOf() []interface{}
}
OneOfExposer exposes "oneOf" items as list of samples.
type Operation ¶
type Operation struct {
// contains filtered or unexported fields
}
func (*Operation) AddResponse ¶ added in v0.0.4
func (*Operation) AddSecurity ¶
func (*Operation) SetDescription ¶
func (*Operation) SetExclude ¶ added in v0.0.4
func (*Operation) SetOperation ¶ added in v0.0.4
func (*Operation) SetSummary ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) AddContentType ¶
type Swagger ¶
type Swagger struct { Config *Config Description string Version string TermsOfService string Routers []*Service Servers openapi3.Servers Contact *openapi3.Contact License *openapi3.License // contains filtered or unexported fields }
func (*Swagger) InitRouter ¶
func (*Swagger) MarshalJSON ¶
func (*Swagger) MarshalYAML ¶
func (*Swagger) OpenapiDataHandler ¶
func (s *Swagger) OpenapiDataHandler() http.HandlerFunc
func (*Swagger) SetRootPath ¶
func (*Swagger) WithService ¶ added in v0.0.4
type ThenExposer ¶ added in v0.0.4
type ThenExposer interface {
JSONSchemaThen() interface{}
}
ThenExposer exposes "then" schema as a sample.
Click to show internal directories.
Click to hide internal directories.