generator

package
v0.0.0-...-e3c0e0a Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APP_JSON        = "application/json"
	APP_XML         = "application/xml"
	SWAGGER_VERSION = "2.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth map[string][]string

type Body

type Body struct {
	Schema BodySchema
}

type BodySchema

type BodySchema struct {
	Type   string `json:"type,omitempty" yaml:",omitempty"`
	Format string `json:"format,omitempty" yaml:",omitempty"`
	Ref    string `json:"$ref,omitempty" yaml:"oneOf,omitempty"`
}

type Contact

type Contact struct {
	Email string `json:"email,omitempty" yaml:",omitempty"`
}

type Definition

type Definition struct {
	Type       string                        `json:"type,omitempty" yaml:",omitempty"`
	Required   []string                      `json:"required,omitempty" yaml:",omitempty"`
	Properties map[string]DefinitionProperty `json:"properties,omitempty" yaml:",omitempty"`
	Xml        *Xml                          `json:"xml,omitempty" yaml:",omitempty"`
	Items      *DefinitionItem               `json:"items,omitempty" yaml:",omitempty"`
}

type DefinitionItem

type DefinitionItem struct {
	Type string `json:"type,omitempty" yaml:",omitempty"`
	Ref  string `json:"$ref,omitempty" yaml:",omitempty"`
}

type DefinitionProperty

type DefinitionProperty struct {
	Type        string      `json:"type,omitempty" yaml:",omitempty"`
	Format      string      `json:"format,omitempty" yaml:",omitempty"`
	Description string      `json:"description,omitempty" yaml:",omitempty"`
	Enum        []string    `json:"enum,omitempty" yaml:",omitempty"`
	Ref         string      `json:"$ref,omitempty" yaml:"oneOf,omitempty"`
	Default     interface{} `json:"default,omitempty" yaml:",omitempty"`
}

type Endpoint

type Endpoint struct {
	Tags        []string            `json:"tags,omitempty" yaml:",omitempty"`
	Summary     string              `json:"summary,omitempty" yaml:",omitempty"`
	Description string              `json:"description,omitempty" yaml:",omitempty"`
	OperationID string              `json:"operationId,omitempty" yaml:"operationId"`
	Consumes    []string            `json:"consumes,omitempty" yaml:",omitempty"`
	Produces    []string            `json:"produces,omitempty" yaml:",omitempty"`
	Parameters  []Parameter         `json:"parameters,omitempty" yaml:",omitempty"`
	RequestBody *RequestBody        `json:"requestBody,omitempty" yaml:"requestBody,omitempty"`
	Responses   map[string]Response `json:"responses,omitempty" yaml:",omitempty"`
	Security    []Auth              `json:"security,omitempty" yaml:",omitempty"`
	Deprecated  bool                `json:"deprecated,omitempty" yaml:",omitempty"`
}

type ExternalDoc

type ExternalDoc struct {
	Description string `json:"description,omitempty" yaml:",omitempty"`
	Url         string `json:"url,omitempty" yaml:",omitempty"`
}

type Generator

type Generator struct {
	SwaggerFile string
}

func NewGenerator

func NewGenerator(filePath string) *Generator

func (*Generator) Generate

func (g *Generator) Generate(parser *parser.Parser, exportAsYaml bool) error

type Info

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

type Item

type Item struct {
	Type    string   `json:"type,omitempty" yaml:",omitempty"`
	Enum    []string `json:"enum,omitempty" yaml:",omitempty"`
	Default string   `json:"default,omitempty" yaml:",omitempty"`
}

type License

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

type Parameter

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

type Property

type Property struct {
	Type        string `json:"type,omitempty" yaml:",omitempty"`
	Format      string `json:"format,omitempty" yaml:",omitempty"`
	Description string `json:"description,omitempty" yaml:",omitempty"`
}

type RequestBody

type RequestBody struct {
	Description string          `json:"description,omitempty" yaml:",omitempty"`
	Required    bool            `json:"required,omitempty" yaml:",omitempty"`
	Content     map[string]Body `json:"content,omitempty" yaml:",omitempty"`
}

type Response

type Response struct {
	Description string              `json:"description"`
	Schema      *ResponseSchema     `json:"schema,omitempty" yaml:",omitempty"`
	Headers     map[string]Property `json:"headers,omitempty" yaml:",omitempty"`
}

type ResponseSchema

type ResponseSchema struct {
	Type                 string    `json:"type,omitempty" yaml:",omitempty"`
	Items                Schema    `json:"items,omitempty" yaml:",omitempty"`
	AdditionalProperties *Property `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"`
}

type Schema

type Schema struct {
	Type       string              `json:"type,omitempty" yaml:",omitempty"`
	Required   []string            `json:"required,omitempty" yaml:",omitempty"`
	Properties map[string]Property `json:"properties,omitempty" yaml:",omitempty"`
	Ref        string              `json:"$ref,omitempty" yaml:"oneOf,omitempty"`
}

type Security

type Security struct {
}

type Swagger

type Swagger struct {
	Swagger             string                         `json:"swagger,omitempty" yaml:",omitempty"`
	Info                Info                           `json:"info"`
	Host                string                         `json:"host,omitempty" yaml:",omitempty"`
	BasePath            string                         `json:"basePath,omitempty" yaml:"basePath,omitempty"`
	Tags                []Tag                          `json:"tags,omitempty" yaml:",omitempty"`
	Schemes             []string                       `json:"schemes,omitempty" yaml:",omitempty"`
	Paths               map[string]map[string]Endpoint `json:"paths"`
	SecurityDefinitions map[string]Security            `json:"securityDefinitions,omitempty" yaml:"securityDefinitions,omitempty"`
	Definitions         map[string]Definition          `json:"definitions,omitempty" yaml:",omitempty"`
	ExternalDocs        *ExternalDoc                   `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
}

type Tag

type Tag struct {
	Name        string       `json:"name,omitempty" yaml:",omitempty"`
	Description string       `json:"description.omitempty" yaml:",omitempty"`
	ExternalDoc *ExternalDoc `json:"externalDoc,omitempty" yaml:",omitempty"`
}

type Xml

type Xml struct {
	Name    string `json:"name,omitempty" yaml:",omitempty"`
	Wrapped bool   `json:"wrapped,omitempty" yaml:",omitempty"`
}

Jump to

Keyboard shortcuts

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