swagger

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2016 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package swagger struct definition

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Contact added in v1.7.0

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

Contact information for the exposed API.

type ExternalDocs added in v1.7.0

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

ExternalDocs include Additional external documentation

type Information added in v1.6.0

type Information struct {
	Title          string `json:"title,omitempty"`
	Description    string `json:"description,omitempty"`
	Version        string `json:"version,omitempty"`
	TermsOfService string `json:"termsOfService,omitempty"`

	Contact Contact `json:"contact,omitempty"`
	License License `json:"license,omitempty"`
}

Information Provides metadata about the API. The metadata can be used by the clients if needed.

type Item added in v1.7.0

type Item struct {
	Ref     string     `json:"$ref,omitempty"`
	Get     *Operation `json:"get,omitempty"`
	Put     *Operation `json:"put,omitempty"`
	Post    *Operation `json:"post,omitempty"`
	Delete  *Operation `json:"delete,omitempty"`
	Options *Operation `json:"options,omitempty"`
	Head    *Operation `json:"head,omitempty"`
	Patch   *Operation `json:"patch,omitempty"`
}

Item Describes the operations available on a single path.

type License added in v1.7.0

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

License information for the exposed API.

type Operation

type Operation struct {
	Tags        []string            `json:"tags,omitempty"`
	Summary     string              `json:"summary,omitempty"`
	Description string              `json:"description,omitempty"`
	OperationID string              `json:"operationId,omitempty"`
	Consumes    []string            `json:"consumes,omitempty"`
	Produces    []string            `json:"produces,omitempty"`
	Schemes     []string            `json:"schemes,omitempty"`
	Parameters  []Parameter         `json:"parameters,omitempty"`
	Responses   map[string]Response `json:"responses,omitempty"`
	Deprecated  bool                `json:"deprecated,omitempty"`
}

Operation Describes a single API operation on a path.

type Parameter

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

Parameter Describes a single operation parameter.

type ParameterItems added in v1.7.0

type ParameterItems struct {
	Type             string            `json:"type,omitempty"`
	Format           string            `json:"format,omitempty"`
	Items            []*ParameterItems `json:"items,omitempty"` //Required if type is "array". Describes the type of items in the array.
	CollectionFormat string            `json:"collectionFormat,omitempty"`
	Default          string            `json:"default,omitempty"`
}

A limited subset of JSON-Schema's items object. It is used by parameter definitions that are not located in "body". http://swagger.io/specification/#itemsObject

type Propertie added in v1.7.0

type Propertie struct {
	Ref                  string               `json:"$ref,omitempty"`
	Title                string               `json:"title,omitempty"`
	Description          string               `json:"description,omitempty"`
	Default              string               `json:"default,omitempty"`
	Type                 string               `json:"type,omitempty"`
	Example              string               `json:"example,omitempty"`
	Required             []string             `json:"required,omitempty"`
	Format               string               `json:"format,omitempty"`
	ReadOnly             bool                 `json:"readOnly,omitempty"`
	Properties           map[string]Propertie `json:"properties,omitempty"`
	Items                *Propertie           `json:"items,omitempty"`
	AdditionalProperties *Propertie           `json:"additionalProperties,omitempty"`
}

Propertie are taken from the JSON Schema definition but their definitions were adjusted to the Swagger Specification

type Response added in v1.7.0

type Response struct {
	Description string  `json:"description,omitempty"`
	Schema      *Schema `json:"schema,omitempty"`
	Ref         string  `json:"$ref,omitempty"`
}

Response as they are returned from executing this operation.

type Schema added in v1.7.0

type Schema struct {
	Ref         string               `json:"$ref,omitempty"`
	Title       string               `json:"title,omitempty"`
	Format      string               `json:"format,omitempty"`
	Description string               `json:"description,omitempty"`
	Required    []string             `json:"required,omitempty"`
	Type        string               `json:"type,omitempty"`
	Items       *Schema              `json:"items,omitempty"`
	Properties  map[string]Propertie `json:"properties,omitempty"`
}

Schema Object allows the definition of input and output data types.

type Scurity added in v1.7.0

type Scurity struct {
	Type             string            `json:"type,omitempty"` // Valid values are "basic", "apiKey" or "oauth2".
	Description      string            `json:"description,omitempty"`
	Name             string            `json:"name,omitempty"`
	In               string            `json:"in,omitempty"`   // Valid values are "query" or "header".
	Flow             string            `json:"flow,omitempty"` // Valid values are "implicit", "password", "application" or "accessCode".
	AuthorizationURL string            `json:"authorizationUrl,omitempty"`
	TokenURL         string            `json:"tokenUrl,omitempty"`
	Scopes           map[string]string `json:"scopes,omitempty"` // The available scopes for the OAuth2 security scheme.
}

Scurity Allows the definition of a security scheme that can be used by the operations

type Swagger added in v1.7.0

type Swagger struct {
	SwaggerVersion      string              `json:"swagger,omitempty"`
	Infos               Information         `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               map[string]*Item    `json:"paths"`
	Definitions         map[string]Schema   `json:"definitions,omitempty"`
	SecurityDefinitions map[string]Scurity  `json:"securityDefinitions,omitempty"`
	Security            map[string][]string `json:"security,omitempty"`
	Tags                []Tag               `json:"tags,omitempty"`
	ExternalDocs        *ExternalDocs       `json:"externalDocs,omitempty"`
}

Swagger list the resource

type Tag added in v1.7.0

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

Tag Allows adding meta data to a single tag that is used by the Operation Object

Jump to

Keyboard shortcuts

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