swagger

package
v0.0.0-...-30f4346 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2015 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package swagger struct definition

Index

Constants

View Source
const SwaggerVersion = "1.2"

SwaggerVersion show the current swagger version

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Path        string      `json:"path"` // relative or absolute, must start with /
	Description string      `json:"description"`
	Operations  []Operation `json:"operations,omitempty"`
}

API show tha API struct

type APIDeclaration

type APIDeclaration struct {
	APIVersion     string           `json:"apiVersion"`
	SwaggerVersion string           `json:"swaggerVersion"`
	BasePath       string           `json:"basePath"`
	ResourcePath   string           `json:"resourcePath"` // must start with /
	Consumes       []string         `json:"consumes,omitempty"`
	Produces       []string         `json:"produces,omitempty"`
	APIs           []API            `json:"apis,omitempty"`
	Models         map[string]Model `json:"models,omitempty"`
}

APIDeclaration see https://github.com/wordnik/swagger-core/blob/scala_2.10-1.3-RC3/schemas/api-declaration-schema.json

type APIKey

type APIKey struct {
	Type   string `json:"type"`   // e.g. apiKey
	PassAs string `json:"passAs"` // e.g. header
}

APIKey see https://github.com/wordnik/swagger-core/wiki/authorizations

type APIRef

type APIRef struct {
	Path        string `json:"path"` // relative or absolute, must start with /
	Description string `json:"description"`
}

APIRef description the api path and description

type Authorization

type Authorization struct {
	LocalOAuth OAuth  `json:"local-oauth"`
	APIKey     APIKey `json:"apiKey"`
}

Authorization see https://github.com/wordnik/swagger-core/wiki/authorizations

type Endpoint

type Endpoint struct {
	URL              string `json:"url"`
	ClientIDName     string `json:"clientIdName"`
	ClientSecretName string `json:"clientSecretName"`
	TokenName        string `json:"tokenName"`
}

Endpoint see https://github.com/wordnik/swagger-core/wiki/authorizations

type ErrorResponse

type ErrorResponse struct {
	Code   int    `json:"code"`
	Reason string `json:"reason"`
}

ErrorResponse desc response

type GrantType

type GrantType struct {
	LoginEndpoint        Endpoint `json:"loginEndpoint"`
	TokenName            string   `json:"tokenName"` // e.g. access_code
	TokenRequestEndpoint Endpoint `json:"tokenRequestEndpoint"`
	TokenEndpoint        Endpoint `json:"tokenEndpoint"`
}

GrantType see https://github.com/wordnik/swagger-core/wiki/authorizations

type Infomation

type Infomation struct {
	Title             string `json:"title,omitempty"`
	Description       string `json:"description,omitempty"`
	Contact           string `json:"contact,omitempty"`
	TermsOfServiceURL string `json:"termsOfServiceUrl,omitempty"`
	License           string `json:"license,omitempty"`
	LicenseURL        string `json:"licenseUrl,omitempty"`
}

Infomation show the API Infomation

type Model

type Model struct {
	ID         string                   `json:"id"`
	Required   []string                 `json:"required,omitempty"`
	Properties map[string]ModelProperty `json:"properties"`
}

Model define the data model

type ModelProperty

type ModelProperty struct {
	Type        string            `json:"type"`
	Description string            `json:"description"`
	Items       map[string]string `json:"items,omitempty"`
	Format      string            `json:"format"`
}

ModelProperty define the properties

type OAuth

type OAuth struct {
	Type       string               `json:"type"`   // e.g. oauth2
	Scopes     []string             `json:"scopes"` // e.g. PUBLIC
	GrantTypes map[string]GrantType `json:"grantTypes"`
}

OAuth see https://github.com/wordnik/swagger-core/wiki/authorizations

type Operation

type Operation struct {
	HTTPMethod string `json:"httpMethod"`
	Nickname   string `json:"nickname"`
	Type       string `json:"type"` // in 1.1 = DataType
	// ResponseClass    string            `json:"responseClass"` obsolete in 1.2
	Summary          string            `json:"summary,omitempty"`
	Notes            string            `json:"notes,omitempty"`
	Parameters       []Parameter       `json:"parameters,omitempty"`
	ResponseMessages []ResponseMessage `json:"responseMessages,omitempty"` // optional
	Consumes         []string          `json:"consumes,omitempty"`
	Produces         []string          `json:"produces,omitempty"`
	Authorizations   []Authorization   `json:"authorizations,omitempty"`
	Protocols        []Protocol        `json:"protocols,omitempty"`
}

Operation desc the Operation

type Parameter

type Parameter struct {
	ParamType     string `json:"paramType"` // path,query,body,header,form
	Name          string `json:"name"`
	Description   string `json:"description"`
	DataType      string `json:"dataType"` // 1.2 needed?
	Type          string `json:"type"`     // integer
	Format        string `json:"format"`   // int64
	AllowMultiple bool   `json:"allowMultiple"`
	Required      bool   `json:"required"`
	Minimum       int    `json:"minimum"`
	Maximum       int    `json:"maximum"`
}

Parameter desc the request parameters

type Protocol

type Protocol struct {
}

Protocol support which Protocol

type ResourceListing

type ResourceListing struct {
	APIVersion     string `json:"apiVersion"`
	SwaggerVersion string `json:"swaggerVersion"` // e.g 1.2
	// BasePath       string `json:"basePath"`  obsolete in 1.1
	APIs  []APIRef   `json:"apis"`
	Infos Infomation `json:"info"`
}

ResourceListing list the resource

type ResponseMessage

type ResponseMessage struct {
	Code          int    `json:"code"`
	Message       string `json:"message"`
	ResponseModel string `json:"responseModel"`
}

ResponseMessage Show the

Jump to

Keyboard shortcuts

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