Documentation
¶
Index ¶
- func Escape(token string) string
- func GetCanonicalTypeName(val any) string
- func IsRequired(tags *structtag.Tags) bool
- func ToRESTFriendlyName(name string) string
- func Unescape(token string) string
- type AllOfExposer
- type AnyOfExposer
- 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 any) *Operation
- func (op *Operation) AddSecurity(security ...security.Security) *Operation
- func (op *Operation) AddTags(tags ...string) *Operation
- func (op *Operation) GetDescription() string
- func (op *Operation) GetMethod() string
- func (op *Operation) GetOperationID() string
- func (op *Operation) GetPath() string
- func (op *Operation) GetSummary() string
- func (op *Operation) GetTags() []string
- 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 any) *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) AddTags(tags ...string) *Service
- func (s *Service) DeleteOf(cb func(op *Operation)) *Service
- func (s *Service) GetName() string
- func (s *Service) GetOf(cb func(op *Operation)) *Service
- func (s *Service) GetOperations() []*Operation
- func (s *Service) GetPath() string
- 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
- type ThenExposer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCanonicalTypeName ¶ added in v0.0.5
func IsRequired ¶ added in v0.1.2
IsRequired checks if a field is required based on its tags
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() []any
}
AllOfExposer exposes "allOf" items as list of samples.
type AnyOfExposer ¶ added in v0.0.4
type AnyOfExposer interface {
JSONSchemaAnyOf() []any
}
AnyOfExposer exposes "anyOf" items as list of samples.
type ElseExposer ¶ added in v0.0.4
type ElseExposer interface {
JSONSchemaElse() any
}
ElseExposer exposes "else" schema as a sample.
type Enum ¶ added in v0.0.4
type Enum interface {
Enum() []any
}
Enum returns the enumerated acceptable values.
type IfExposer ¶ added in v0.0.4
type IfExposer interface {
JSONSchemaIf() any
}
IfExposer exposes "if" schema as a sample.
type NamedEnum ¶ added in v0.0.4
NamedEnum returns the enumerated acceptable values with according string names.
type NotExposer ¶ added in v0.0.4
type NotExposer interface {
JSONSchemaNot() any
}
NotExposer exposes "not" schema as a sample.
type OneOfExposer ¶ added in v0.0.4
type OneOfExposer interface {
JSONSchemaOneOf() []any
}
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) GetDescription ¶ added in v0.1.2
GetDescription returns the operation's description
func (*Operation) GetOperationID ¶ added in v0.1.2
GetOperationID returns the operation's ID
func (*Operation) GetSummary ¶ added in v0.1.2
GetSummary returns the operation's summary
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 ¶
func (*Service) GetOperations ¶ added in v0.1.2
GetOperations returns all operations in the service
type Swagger ¶
type Swagger struct {
Title string
Description string
Version string
TermsOfService string
Routers []*Service
Servers openapi3.Servers
Contact *openapi3.Contact
License *openapi3.License
// contains filtered or unexported fields
}
func (*Swagger) BuildSwagger ¶ added in v0.1.2
func (*Swagger) MarshalJSON ¶
func (*Swagger) MarshalYAML ¶
func (*Swagger) SetRootPath ¶
func (*Swagger) WithService ¶ added in v0.0.4
type ThenExposer ¶ added in v0.0.4
type ThenExposer interface {
JSONSchemaThen() any
}
ThenExposer exposes "then" schema as a sample.