Documentation ¶
Overview ¶
Copyright (C) 2016-2017 dapperdox.com
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright (C) 2016-2017 dapperdox.com ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Variables
- func CamelToKebab(s string) string
- func HTTPStatusDescription(status int) string
- func JSONMarshalIndent(v interface{}) ([]byte, error)
- func LoadSpecifications(specHost string, collapse bool) error
- func LoadStatusCodes()
- func TitleToKebab(s string) string
- type APIGroup
- type APISet
- type APISpecification
- type Header
- type Info
- type Method
- type OAuth2Scheme
- type Parameter
- type Resource
- type ResourceOrigin
- type Response
- type Security
- type SecurityScheme
- type SortMethods
- type Version
Constants ¶
This section is empty.
Variables ¶
var APISuite map[string]*APISpecification
var StatusCodes map[int]string
Functions ¶
func CamelToKebab ¶
func HTTPStatusDescription ¶
func JSONMarshalIndent ¶
----------------------------------------------------------------------------- Wrapper around MarshalIndent to prevent < > & from being escaped
func LoadSpecifications ¶
func LoadStatusCodes ¶
func LoadStatusCodes()
func TitleToKebab ¶
Types ¶
type APIGroup ¶
type APIGroup struct { ID string Name string URL *url.URL MethodSortBy []string Versions map[string][]Method // All versions, keyed by version string. Methods []Method // The current version CurrentVersion string // The latest version in operation for the API Info *Info Consumes []string Produces []string }
APIGroup parents all grouped API methods (Grouping controlled by tagging, if used, or by method path otherwise)
type APISpecification ¶
type APISpecification struct { ID string APIs APISet // APIs represents the parsed APIs APIInfo Info URL string SecurityDefinitions map[string]SecurityScheme DefaultSecurity map[string]Security ResourceList map[string]map[string]*Resource // Version->ResourceName->Resource APIVersions map[string]APISet // Version->APISet }
func (*APISpecification) GetByID ¶
func (c *APISpecification) GetByID(id string) *APIGroup
GetByID returns an API by ID
func (*APISpecification) GetByName ¶
func (c *APISpecification) GetByName(name string) *APIGroup
GetByName returns an API by name
type Method ¶
type Method struct { ID string Name string Description string Method string OperationName string Path string Consumes []string Produces []string PathParams []Parameter QueryParams []Parameter HeaderParams []Parameter BodyParam *Parameter FormParams []Parameter Responses map[int]Response DefaultResponse *Response // A ptr to allow of easy checking of its existance in templates Resources []*Resource Security map[string]Security APIGroup *APIGroup SortKey string }
Method represents an API method
type OAuth2Scheme ¶
type Parameter ¶
type Parameter struct { Name string Description string In string CollectionFormat string CollectionFormatDescription string Required bool Type []string Enum []string Resource *Resource // For "in body" parameters IsArray bool // "in body" parameter is an array }
Parameter represents an API method parameter
type Resource ¶
type Resource struct { ID string FQNS []string Title string Description string Example string Schema string Type []string // Will contain two elements if an array or map [0]=array [1]=What type is in the array Properties map[string]*Resource Required bool ReadOnly bool ExcludeFromOperations []string Methods map[string]*Method Enum []string // contains filtered or unexported fields }
Resource represents an API resource
type ResourceOrigin ¶
type ResourceOrigin int
const ( RequestBody ResourceOrigin = iota MethodResponse )
type Response ¶
type Response struct { Description string StatusDescription string Resource *Resource Headers []Header IsArray bool }
Response represents an API method response
type Security ¶
type Security struct { Scheme *SecurityScheme Scopes map[string]string }
type SecurityScheme ¶
type SortMethods ¶
type SortMethods []Method
func (SortMethods) Len ¶
func (a SortMethods) Len() int
func (SortMethods) Less ¶
func (a SortMethods) Less(i, j int) bool
func (SortMethods) Swap ¶
func (a SortMethods) Swap(i, j int)