swagger

package
v0.0.0-...-eb3b190 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2016 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Overview

Package swagger provides swagger specification models

Index

Constants

This section is empty.

Variables

View Source
var GlobalDefinitions = make(Definitions)

Functions

This section is empty.

Types

type Contact

type Contact struct {
	Name  string `json:"name,omitempty"`
	URL   string `json:"url,omitempty"`
	Email string `json:"email,omitempty"`
}

Contact struct

type Definitions

type Definitions map[string]Schema

Definitions is global model definitions

func (Definitions) AddModelFrom

func (d Definitions) AddModelFrom(model interface{})

AddModelFrom adds model definitions from model

type Document

type Document struct {
	Swagger            string               `json:"swagger"`
	Info               Info                 `json:"info"`
	Host               string               `json:"host,omitempty"`
	BasePath           string               `json:"basePath,omitempty"`
	Schemes            []string             `json:"schemes,omitempty"`
	Consumes           []string             `json:"consumes,omitempty"`
	Produces           []string             `json:"produces,omitempty"`
	Paths              Paths                `json:"paths"`
	Definitions        Definitions          `json:"definitions,omitempty"`
	Parameters         map[string]Parameter `json:"parameters,omitempty"`
	Responses          Responses            `json:"responses,omitempty"`
	SecurityDefinitons SecurityDefinitons   `json:"securityDefinitions,omitempty"`
	Security           Security             `json:"security,omitempty"`
	Tags               []Tag                `json:"tags,omitempty"`
	ExternalDocs       *ExternalDocs        `json:"externalDocs,omitempty"`
}

Document struct

func (*Document) DocBasePath

func (doc *Document) DocBasePath(path string) *Document

DocBasePath sets basepath of document

func (*Document) DocConsumes

func (doc *Document) DocConsumes(mimeTypes ...string) *Document

DocConsumes sets consumes of document

func (*Document) DocDefinition

func (doc *Document) DocDefinition(model interface{}) *Document

DocDefinition adds model definition

func (*Document) DocHost

func (doc *Document) DocHost(host string) *Document

DocHost sets dochost of document

func (*Document) DocInfo

func (doc *Document) DocInfo(title, description, version, termsOfServeice string) *Document

DocInfo sets info of document

func (*Document) DocInfoContace

func (doc *Document) DocInfoContace(name, url, email string) *Document

DocInfoContace sets info contace of document

func (*Document) DocInfoLicense

func (doc *Document) DocInfoLicense(name, url string) *Document

DocInfoLicense sets info license of document

func (*Document) DocProduces

func (doc *Document) DocProduces(mimeTypes ...string) *Document

DocProduces sets produces of document

func (*Document) DocTag

func (doc *Document) DocTag(name, description string) *Document

DocTag adds tag to document

type Example

type Example map[string]interface{}

Example type

type ExternalDocs

type ExternalDocs struct {
	Description string `json:"description,omitempty"`
	URL         string `json:"url"`
}

ExternalDocs struct

type Header struct {
	Items
	Description string `json:"description,omitempty"`
}

Header struct

type Headers

type Headers map[string]Header

Headers type

type Info

type Info struct {
	Title          string   `json:"title"`
	Description    string   `json:"description,omitempty"`
	Version        string   `json:"version"`
	TermsOfService string   `json:"termsOfService,omitempty"`
	Contact        *Contact `json:"contact,omitempty"`
	License        *License `json:"license,omitempty"`
}

Info struct

type Items

type Items struct {
	Reference
	Items            *Items        `json:"items,omitempty"`
	Type             string        `json:"type,omitempty"`
	Format           string        `json:"format,omitempty"`
	CollectionFormat string        `json:"collectionFormat,omitempty"`
	Default          interface{}   `json:"default,omitempty"`
	Maximum          int           `json:"maximum,omitempty"`
	ExclusiveMaximum bool          `json:"exclusiveMaximum,omitempty"`
	Minimum          int           `json:"minimum,omitempty"`
	ExclusiveMinimum bool          `json:"exclusiveMinimum,omitempty"`
	MaxLength        int           `json:"maxLength,omitempty"`
	MinLength        int           `json:"minLength,omitempty"`
	UniqueItems      bool          `json:"uniqueItems,omitempty"`
	Enum             []interface{} `json:"enum,omitempty"`
	MultipleOf       int           `json:"multipleOf,omitempty"`
}

Items struct

type License

type License struct {
	Name string `json:"name"`
	URL  string `json:"url,omitempty"`
}

License struct

type Operation

type Operation struct {
	Reference
	Tags         []string      `json:"tags,omitempty"`
	Summary      string        `json:"summary,omitempty"`
	Description  string        `json:"description,omitempty"`
	ExternalDocs *ExternalDocs `json:"externalDocs,omitempty"`
	OperationID  string        `json:"operationId,omitempty"`
	Parameters   Parameters    `json:"parameters,omitempty"`
	Consumes     []string      `json:"comsumes,omitempty"`
	Produces     []string      `json:"produces,omitempty"`
	Responses    Responses     `json:"responses,omitempty"`
	Schemes      []string      `json:"schemes,omitempty"`
	Deprecated   bool          `json:"deprecated,omitempty"`
	Security     Security      `json:"security,omitempty"`
}

Operation struct

func (*Operation) DocConsumes

func (o *Operation) DocConsumes(mimeTypes ...string) *Operation

DocConsumes sets consume mime types of this Operation

func (*Operation) DocDeprecated

func (o *Operation) DocDeprecated(d bool) *Operation

DocDeprecated sets if this Operation is deprecated

func (*Operation) DocParameter

func (o *Operation) DocParameter(param Parameter) *Operation

DocParameter sets parameter of this Operation

func (*Operation) DocParameterBody

func (o *Operation) DocParameterBody(paramName, desc string, model interface{}, required bool) *Operation

DocParameterBody set body model parameter of this Operation

func (*Operation) DocParameterBodyRef

func (o *Operation) DocParameterBodyRef(paramName, desc string, ref string, required bool) *Operation

DocParameterBodyRef set body ref parameter of this Operation

func (*Operation) DocParameterMultiQuery

func (o *Operation) DocParameterMultiQuery(paramName, paramType, desc string, required bool) *Operation

DocParameterMultiQuery sets multi query parameter of this Operation

func (*Operation) DocParameterPath

func (o *Operation) DocParameterPath(paramName, paramType, desc string, required bool) *Operation

DocParameterPath sets path parameter of this Operation

func (*Operation) DocParameterQuery

func (o *Operation) DocParameterQuery(paramName, paramType, desc string, required bool) *Operation

DocParameterQuery sets query parameter of this Operation

func (*Operation) DocProduces

func (o *Operation) DocProduces(mimeTypes ...string) *Operation

DocProduces sets produce mime types of this Operation

func (*Operation) DocResponse

func (o *Operation) DocResponse(code string, resp Response) *Operation

DocResponse sets response of this Operation

func (*Operation) DocResponseModel

func (o *Operation) DocResponseModel(code string, desc string, model interface{}) *Operation

DocResponseModel sets response model of this Operation

func (*Operation) DocResponseRef

func (o *Operation) DocResponseRef(code, desc, ref string) *Operation

DocResponseRef sets response model ref of this Operation

func (*Operation) DocResponseSimple

func (o *Operation) DocResponseSimple(code string, desc string) *Operation

DocResponseSimple sets simple response which only contains code and description info of this Operation

func (*Operation) DocSchemes

func (o *Operation) DocSchemes(schemes ...string) *Operation

DocSchemes set schemes of this Operation

func (*Operation) DocSecurity

func (o *Operation) DocSecurity(name string, scopes []string) *Operation

DocSecurity set security of this Operation

func (*Operation) DocSumDesc

func (o *Operation) DocSumDesc(summary, description string) *Operation

DocSumDesc sets summary and description of this operation

func (*Operation) DocTags

func (o *Operation) DocTags(tags ...string) *Operation

DocTags sets tags of this Operation

type Parameter

type Parameter struct {
	Items
	Name        string  `json:"name,omitempty"`
	In          string  `json:"in"`
	Description string  `json:"description,omitempty"`
	Required    bool    `json:"required,omitempty"`
	Schema      *Schema `json:"schema,omitempty"`
}

Parameter struct

type Parameters

type Parameters []Parameter

type Path

type Path map[string]Operation

Path type

type Paths

type Paths map[string]Path

Paths type

type Reference

type Reference struct {
	Ref string `json:"$ref,omitempty"`
}

Reference struct

type Response

type Response struct {
	Description string   `json:"description"`
	Schema      *Schema  `json:"schema,omitempty"`
	Headers     *Headers `json:"headers,omitempty"`
	Example     Example  `json:"example,omitempty"`
}

Response struct

type Responses

type Responses map[string]Response

Responses type

type Schema

type Schema struct {
	Reference
	Type       string           `json:"type,omitempty"`
	Required   []string         `json:"required,omitempty"`
	Properties map[string]Items `json:"properties,omitempty"`
}

Schema struct

type Scopes

type Scopes map[string]string

Scopes type

type Security

type Security map[string][]string

Security type

type SecurityDefiniton

type SecurityDefiniton struct {
	Type             string `json:"type"`
	Description      string `json:"description,omitempty"`
	Name             string `json:"name"`
	In               string `json:"in"`
	Flow             string `json:"flow"`
	AuthorizationURL string `json:"authorizationUrl"`
	TokenURL         string `json:"tokenUrl"`
	Scopes           Scopes `json:"scopes"`
}

SecurityDefiniton struct

type SecurityDefinitons

type SecurityDefinitons map[string]SecurityDefiniton

SecurityDefinitons type

type Tag

type Tag struct {
	Name         string        `json:"name"`
	Description  string        `json:"description,omitempty"`
	ExternalDocs *ExternalDocs `json:"externalDocs,omitempty"`
}

Tag struct

type XML

type XML struct {
	Name      string `json:"name,omitempty"`
	Namespace string `json:"namespace,omitempty"`
	Prefix    string `json:"prefix,omitempty"`
	Attribute bool   `json:"attribute,omitempty"`
	Wrapped   bool   `json:"wrapped,omitempty"`
}

XML struct

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL