Documentation ¶
Overview ¶
Package swagger struct definition
Index ¶
- Constants
- Variables
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetFS() *assetfs.AssetFS
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func CreateProperties(obj interface{}) map[string]*Property
- func MustAsset(name string) []byte
- func ParamType(value interface{}) string
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func SliceInfo(value interface{}) (subtyp string, first interface{}, count int)
- type Contact
- type Definition
- type Info
- type Items
- type License
- type Opera
- type Parameter
- type Property
- type Resp
- type Schema
- type Swagger
- type Tag
- type Xml
Constants ¶
const Version = "2.0"
Version show the current swagger version
Variables ¶
var CommonMIMETypes = []string{
"application/json",
"application/javascript",
"application/xml",
"application/x-www-form-urlencoded",
"application/protobuf",
"application/msgpack",
"text/html",
"text/plain",
"multipart/form-data",
"application/octet-stream",
}
CommonMIMETypes common MIME types
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func CreateProperties ¶
CreateProperties creates properties
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func ParamType ¶
func ParamType(value interface{}) string
ParamType type of the parameter value passed in
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
type Definition ¶
type Definition struct { Type string `json:"type,omitempty"` // "object" Properties map[string]*Property `json:"properties,omitempty"` Xml *Xml `json:"xml,omitempty"` }
Definition object
type Info ¶
type Info struct { Title string `json:"title"` ApiVersion string `json:"version"` Description string `json:"description"` Contact *Contact `json:"contact"` TermsOfService string `json:"termsOfService"` License *License `json:"license,omitempty"` }
Info object
type Items ¶
type Items struct { Ref string `json:"$ref,omitempty"` Type string `json:"type"` // "string" Enum interface{} `json:"enum,omitempty"` // slice Default interface{} `json:"default,omitempty"` }
Items object
type Opera ¶
type Opera struct { Tags []string `json:"tags"` Summary string `json:"summary"` Description string `json:"description"` OperationId string `json:"operationId"` Consumes []string `json:"consumes,omitempty"` Produces []string `json:"produces,omitempty"` Parameters []*Parameter `json:"parameters,omitempty"` Responses map[string]*Resp `json:"responses,omitempty"` // {"httpcode":resp} Security []map[string][]string `json:"security,omitempty"` }
Opera object
type Parameter ¶
type Parameter struct { In string `json:"in"` // the position of the parameter Name string `json:"name"` Description string `json:"description"` Required bool `json:"required"` Type string `json:"type,omitempty"` // "array"|"integer"|"object" Items *Items `json:"items,omitempty"` Schema *Schema `json:"schema,omitempty"` CollectionFormat string `json:"collectionFormat,omitempty"` // "multi" Format string `json:"format,omitempty"` // "int64" Default interface{} `json:"default,omitempty"` }
Parameter object
type Property ¶
type Property struct { Type string `json:"type,omitempty"` // "array"|"integer"|"object" Format string `json:"format,omitempty"` // "int64" Description string `json:"description,omitempty"` Enum []string `json:"enum,omitempty"` Example interface{} `json:"example,omitempty"` Default interface{} `json:"default,omitempty"` }
Property object
type Resp ¶
type Resp struct { Schema *Schema `json:"schema,omitempty"` Description string `json:"description,omitempty"` }
Resp object
type Schema ¶
type Schema struct { Ref string `json:"$ref,omitempty"` Type string `json:"type,omitempty"` // "array"|"integer"|"object" Items *Items `json:"items,omitempty"` Description string `json:"description,omitempty"` AdditionalProperties map[string]string `json:"additionalProperties,omitempty"` }
Schema object
type Swagger ¶
type Swagger struct { Version string `json:"swagger"` Info *Info `json:"info"` Host string `json:"host"` BasePath string `json:"basePath"` Tags []*Tag `json:"tags"` Schemes []string `json:"schemes"` Paths map[string]map[string]*Opera `json:"paths,omitempty"` // {"prefix":{"method":{...}}} SecurityDefinitions map[string]map[string]interface{} `json:"securityDefinitions,omitempty"` Definitions map[string]*Definition `json:"definitions,omitempty"` ExternalDocs map[string]string `json:"externalDocs,omitempty"` }
Swagger object