Documentation
¶
Index ¶
- func CamelCase(src string) string
- func IsFilePermissionTooOpen(path string) (bool, error)
- func OptionCase(s string) string
- func ProtectFile(path string) error
- func SnakeCase(s string) string
- func TitleCase(src string) string
- type APIDefinitions
- type APIMethod
- type APIParam
- type APIParamArrayItems
- type APIParamSchema
- type APIResponse
- type Pagination
- type Request
- type Response
- type StructDef
- type StructProperty
- type StructReference
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CamelCase ¶
CamelCase converts strings like "space separated", "dash-separated", "snake_case" to "camelCase" but does not convert "TitleCase" to "camelCase"
func IsFilePermissionTooOpen ¶ added in v0.2.1
func OptionCase ¶
OptionCase converts strings like "space separated", "snake_case", "camelCase", "TitleCase" to "option-case"
func ProtectFile ¶ added in v0.2.1
Types ¶
type APIDefinitions ¶
type APIDefinitions struct {
Host string
Schemes []string
BasePath string
Methods []APIMethod
StructDefs map[string]StructDef
}
APIDefinitions holds all information about SORACOM API
func LoadAPIDef ¶
func LoadAPIDef(apiDefYAMLFile string) (*APIDefinitions, error)
LoadAPIDef loads API definitions from the specified file
type APIMethod ¶
type APIMethod struct {
Path string
Method string
Use string
Tags []string `yaml:"tags"`
Summary string `yaml:"summary"`
Description string `yaml:"description"`
OperationID string `yaml:"operationId"`
Security []map[string]interface{} `yaml:"security"`
CLI []string `yaml:"x-soracom-cli"`
Pagination *Pagination `yaml:"x-soracom-cli-pagination"`
Parameters []APIParam `yaml:"parameters"`
Responses map[string]APIResponse `yaml:"responses"`
}
APIMethod holds information about an API method
type APIParam ¶
type APIParam struct {
Name string `yaml:"name"`
In string `yaml:"in"`
Required bool `yaml:"required"`
Description string `yaml:"description"`
Type string `yaml:"type"`
Enum []string `yaml:"enum"`
Default interface{} `yaml:"default,omitempty"`
Schema APIParamSchema `yaml:"schema"`
Items APIParamArrayItems `yaml:"items"`
}
APIParam holds information about an API parameter
func (*APIParam) GetDefaultValueAsBool ¶ added in v0.5.4
func (*APIParam) GetDefaultValueAsFloat ¶ added in v0.5.4
func (*APIParam) GetDefaultValueAsInt64 ¶ added in v0.5.4
func (*APIParam) GetDefaultValueAsString ¶ added in v0.5.4
type APIParamArrayItems ¶ added in v0.2.8
APIParamArrayItems holds information about array type of parameters
type APIParamSchema ¶
type APIParamSchema struct {
Type string `yaml:"type"`
Format string `yaml:"format"`
Items *APIParamSchema `yaml:"items"`
Ref string `yaml:"$ref"`
}
APIParamSchema holds information about a Schema in an API parameter
type APIResponse ¶
type APIResponse struct {
Schema *APIParamSchema
}
APIResponse holds information about an API response
type Pagination ¶ added in v0.4.8
type StructDef ¶
type StructDef struct {
Properties []StructProperty
References []StructReference
}
StructDef holds all information under /definitions in API definition file
type StructProperty ¶
type StructProperty struct {
Name string
Type string
Format string
Description string
Required bool
Default interface{}
}
StructProperty holds information about an entry under /definitions/{StructName}/properties in API definition file
func (*StructProperty) GetDefaultValueAsBool ¶ added in v0.5.4
func (p *StructProperty) GetDefaultValueAsBool() bool
func (*StructProperty) GetDefaultValueAsFloat ¶ added in v0.5.4
func (p *StructProperty) GetDefaultValueAsFloat() float64
func (*StructProperty) GetDefaultValueAsInt64 ¶ added in v0.5.4
func (p *StructProperty) GetDefaultValueAsInt64() int64
func (*StructProperty) GetDefaultValueAsString ¶ added in v0.5.4
func (p *StructProperty) GetDefaultValueAsString() string
type StructReference ¶
StructReference holds information about a reference from a property in API definition file