swagger

package
v0.0.0-...-92e4bff Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2013 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package swagger implements the structures of the Swagger (https://github.com/wordnik/swagger-core/wiki) specification

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstallSwaggerService

func InstallSwaggerService(aSwaggerConfig Config)

InstallSwaggerService add the WebService that provides the API documentation of all services conform the Swagger documentation specifcation. (https://github.com/wordnik/swagger-core/wiki).

Types

type Api

type Api struct {
	Path        string           `json:"path"`
	Description string           `json:"description"`
	Operations  []Operation      `json:"operations"`
	Models      map[string]Model `json:"models"`
}

type ApiDeclaration

type ApiDeclaration struct {
	ApiVersion     string `json:"apiVersion"`
	SwaggerVersion string `json:"swaggerVersion"`
	BasePath       string `json:"basePath"`
	ResourcePath   string `json:"resourcePath"`
	Apis           []Api  `json:"apis"`
}

type Config

type Config struct {
	WebServicesUrl  string // url where the services are available, e.g. http://localhost:8080
	ApiPath         string // path where the JSON api is avaiable , e.g. /apidocs
	SwaggerPath     string // [optional] path where the swagger UI will be served, e.g. /swagger
	SwaggerFilePath string // [optional] location of folder containing Swagger HTML5 application index.html
	WebServices     []*restful.WebService
}

type ErrorResponse

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

type Model

type Model struct {
	Id         string                   `json:"id"`
	Properties map[string]ModelProperty `json:"properties"`
}

type ModelProperty

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

type Operation

type Operation struct {
	HttpMethod     string          `json:"httpMethod"`
	Nickname       string          `json:"nickname"`
	ResponseClass  string          `json:"responseClass"`
	Summary        string          `json:"summary"`
	Notes          string          `json:"notes"`
	Parameters     []Parameter     `json:"parameters"`
	ErrorResponses []ErrorResponse `json:"errorResponses"`
}

type Parameter

type Parameter struct {
	ParamType       string            `json:"paramType"`
	Name            string            `json:"name"`
	Description     string            `json:"description"`
	DataType        string            `json:"dataType"`
	Required        bool              `json:"required"`
	AllowableValues map[string]string `json:"allowableValues,omitempty"`
	AllowMultiple   bool              `json:"allowMultiple"`
}

type ResourceListing

type ResourceListing struct {
	ApiVersion     string `json:"apiVersion"`
	SwaggerVersion string `json:"swaggerVersion"`
	BasePath       string `json:"basePath"`
	Apis           []Api  `json:"apis"`
}

Jump to

Keyboard shortcuts

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