Documentation
¶
Index ¶
- func SetRenderer(api *OpenAPI, renderer Renderer) error
- func Traverse[T Traversable](node T, f TraversalFunc) (T, error)
- func TraverseRecursor[T Traversable](node T, f TraversalFunc) (T, error)
- type Callback
- type Components
- type Config
- type Example
- type ExternalDocs
- type GinRenderer
- type Header
- type Info
- type Link
- type MediaType
- type OpenAPI
- type Operation
- type Parameter
- type PathItem
- func (n *PathItem) GetMetadata() map[string]string
- func (n *PathItem) GetName() string
- func (n *PathItem) GetOutputFile() string
- func (n *PathItem) GetParent() Traversable
- func (p *PathItem) GetPath() string
- func (p *PathItem) Operations() map[string]Traversable
- func (n *PathItem) SetMetadata(metadata map[string]string)
- type Renderer
- type RequestBody
- type Response
- type Schema
- type SecurityScheme
- type Server
- type ServerVariable
- type Traversable
- type TraversalFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetRenderer ¶ added in v0.0.4
func Traverse ¶ added in v0.0.4
func Traverse[T Traversable](node T, f TraversalFunc) (T, error)
Traverse takes a Traversable node and enters into a recursive loop (TraverseRecursor) that applies a given function to the node.
func TraverseRecursor ¶ added in v0.0.4
func TraverseRecursor[T Traversable](node T, f TraversalFunc) (T, error)
TraverseRecursor is an auxiliary function to Traverse that initiates a recursive loop over a tree of Traversable structs, applying a given function at every step.
Types ¶
type Callback ¶ added in v0.0.4
type Callback struct{}
Callback is a programmatic representation of the Callback object defined here: https://swagger.io/specification/#callback-object
type Components ¶
type Components struct { Schemas map[string]Schema // can also be a $ref Responses map[string]Response // can also be a $ref Parameters map[string]Parameter // can also be a $ref Examples map[string]Example // can also be a $ref RequestBodies map[string]RequestBody // can also be a $ref Headers map[string]Header // can also be a $ref SecuritySchemes map[string]SecurityScheme // can also be a $ref Links map[string]Link // can also be a $ref Callbacks map[string]Callback // can also be a $ref }
Components is a programmatic representation of the Components object defined here: https://swagger.io/specification/#components-object
type Example ¶ added in v0.0.4
type Example struct { Summary string `yaml:"summary"` Description string `yaml:"description"` Value interface{} `yaml:"value"` // TODO: does this imply an explicit need for reflective interpretation of data while marshalling? ExternalValue string `yaml:"externalValue"` }
Example is a programmatic representation of the Example object defined here: https://swagger.io/specification/#components-object
type ExternalDocs ¶
ExternalDocs is a programmatic representation of the External Docs object defined here: https://swagger.io/specification/#external-documentation-object
type GinRenderer ¶ added in v0.0.4
type GinRenderer struct{}
type Header ¶ added in v0.0.4
type Header struct{}
Header is a programmatic representation of the Header object defined here:https://swagger.io/specification/#header-object
type Info ¶
type Info struct { Title string `yaml:"title"` Description string `yaml:"description"` TermsOfService string `yaml:"termsOfService"` Version string `yaml:"version"` Contact struct { Name string `yaml:"name"` Url string `yaml:"url"` Email string `yaml:"email"` } License struct { Name string `yaml:"name"` Url string `yaml:"url"` } }
Info is a programmatic representation of the Info object defined here: https://swagger.io/specification/#info-object
type Link ¶ added in v0.0.4
type Link struct{}
Link is a programmatic representation of the Link object defined here: https://swagger.io/specification/#link-object
type MediaType ¶
type MediaType struct { Schema *Schema // contains filtered or unexported fields }
MediaType is a programmatic representation of the MediaType object defined here: https://swagger.io/specification/#media-type-object
func (*MediaType) GetMetadata ¶ added in v0.0.4
func (*MediaType) GetOutputFile ¶ added in v0.0.4
func (n *MediaType) GetOutputFile() string
func (*MediaType) GetParent ¶ added in v0.0.4
func (n *MediaType) GetParent() Traversable
func (*MediaType) SetMetadata ¶ added in v0.0.4
type OpenAPI ¶
type OpenAPI struct { OpenAPI string `yaml:"openapi"` Info Info Servers []Server Paths map[string]*PathItem Components Components // contains filtered or unexported fields }
OpenAPI is a programmatic representation of the OpenApi Document object defined here: https://swagger.io/specification/#openapi-object
func LoadOpenAPI ¶
func (*OpenAPI) GetMetadata ¶ added in v0.0.4
func (*OpenAPI) GetOutputFile ¶ added in v0.0.4
func (*OpenAPI) GetParent ¶ added in v0.0.4
func (n *OpenAPI) GetParent() Traversable
func (*OpenAPI) SetMetadata ¶ added in v0.0.4
type Operation ¶
type Operation struct { Tags []string Summary string Description string Parameters []Parameter // can be a $ref RequestBody RequestBody `yaml:"requestBody"` // can be a $ref Responses map[string]*Response // can be a $ref //Callbacks map[string]*Callback // can be a $ref OperationId string `yaml:"operationId"` ExternalDocs ExternalDocs // contains filtered or unexported fields }
Operation is a programmatic representation of the Operation object defined here: https://swagger.io/specification/#operation-object
func (*Operation) GetMetadata ¶ added in v0.0.4
func (*Operation) GetOutputFile ¶ added in v0.0.4
func (n *Operation) GetOutputFile() string
func (*Operation) GetParent ¶ added in v0.0.4
func (n *Operation) GetParent() Traversable
func (*Operation) SetMetadata ¶ added in v0.0.4
type Parameter ¶
type Parameter struct { Ref string `yaml:"$ref"` Name string `yaml:"name"` In string `yaml:"in"` Description string `yaml:"description"` Required bool `yaml:"required"` Deprecated bool `yaml:"deprecated"` AllowEmptyValue bool `yaml:"allowEmptyValue"` Schema *Schema // Acts as alternative description of param // contains filtered or unexported fields }
Parameter is a programmatic representation of the Parameter object defined here: https://swagger.io/specification/#parameter-object
func (*Parameter) GetMetadata ¶ added in v0.0.4
func (*Parameter) GetOutputFile ¶ added in v0.0.4
func (*Parameter) GetParent ¶ added in v0.0.4
func (n *Parameter) GetParent() Traversable
func (*Parameter) SetMetadata ¶ added in v0.0.4
type PathItem ¶
type PathItem struct { Ref string `yaml:"$ref"` // must be defined in the format of a PathItem object Summary string Description string Get *Operation Post *Operation Patch *Operation Delete *Operation Parameters []Parameter // contains filtered or unexported fields }
PathItem is a programmatic representation of the Path Item object defined here: https://swagger.io/specification/#path-item-object
func (*PathItem) GetMetadata ¶ added in v0.0.4
func (*PathItem) GetOutputFile ¶ added in v0.0.4
func (n *PathItem) GetOutputFile() string
func (*PathItem) GetParent ¶ added in v0.0.4
func (n *PathItem) GetParent() Traversable
func (*PathItem) Operations ¶
func (p *PathItem) Operations() map[string]Traversable
func (*PathItem) SetMetadata ¶ added in v0.0.4
type Renderer ¶ added in v0.0.4
type Renderer interface {
// contains filtered or unexported methods
}
type RequestBody ¶
type RequestBody struct { Ref string Description string Content map[string]*MediaType Required bool // contains filtered or unexported fields }
RequestBody is a programmatic representation of the RequestBody object defined here: https://swagger.io/specification/#request-body-object
func (*RequestBody) GetMetadata ¶ added in v0.0.4
func (*RequestBody) GetName ¶ added in v0.0.4
func (r *RequestBody) GetName() string
func (*RequestBody) GetOutputFile ¶ added in v0.0.4
func (n *RequestBody) GetOutputFile() string
func (*RequestBody) GetParent ¶ added in v0.0.4
func (n *RequestBody) GetParent() Traversable
func (*RequestBody) SetMetadata ¶ added in v0.0.4
type Response ¶
type Response struct { Ref string Description string `yaml:"description"` Headers map[string]Header // can also be a $ref Content map[string]MediaType Links map[string]Link // can also be a $ref // contains filtered or unexported fields }
Response is a programmatic representation of the Response object defined here: https://swagger.io/specification/#response-object
func (*Response) GetMetadata ¶ added in v0.0.4
func (*Response) GetOutputFile ¶ added in v0.0.4
func (n *Response) GetOutputFile() string
func (*Response) GetParent ¶ added in v0.0.4
func (n *Response) GetParent() Traversable
func (*Response) SetMetadata ¶ added in v0.0.4
type Schema ¶
type Schema struct { Ref string `yaml:"$ref"` Description string Type string Properties map[string]*Schema Items *Schema AdditionalProperties bool MinLength int `yaml:"minLength"` MaxLength int `yaml:"maxLength"` Pattern string Format string Required []string // contains filtered or unexported fields }
Schema is a programmatic representation of the Schema object defined here: https://swagger.io/specification/#schema-object
func (*Schema) GetMetadata ¶ added in v0.0.4
func (*Schema) GetOutputFile ¶ added in v0.0.4
func (n *Schema) GetOutputFile() string
func (*Schema) GetParent ¶ added in v0.0.4
func (n *Schema) GetParent() Traversable
func (*Schema) SetMetadata ¶ added in v0.0.4
type SecurityScheme ¶ added in v0.0.4
type SecurityScheme struct{}
SecurityScheme is a programmatic representation of the SecurityScheme object defined here: https://swagger.io/specification/#security-scheme-object
type Server ¶ added in v0.0.4
type Server struct { Url string `yaml:"url"` Description string `yaml:"description"` Variables map[string]ServerVariable }
Server is a programmatic representation of the OpenApi Document object defined here: https://swagger.io/specification/#openapi-object
type ServerVariable ¶ added in v0.0.4
type Traversable ¶ added in v0.0.4
type Traversable interface { GetParent() Traversable // Node Attributes GetName() string GetOutputFile() string GetMetadata() map[string]string SetMetadata(metadata map[string]string) // contains filtered or unexported methods }
func Dig ¶ added in v0.0.4
func Dig(node Traversable, key ...string) Traversable
type TraversalFunc ¶ added in v0.0.4
type TraversalFunc func(key string, parent, child Traversable) (Traversable, error)