swagger

package
v0.0.0-...-54afde0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(outputDir string) error

Types

type Contact

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

Contact represents a Contact object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#contact-object

type Example

type Example map[string]interface{}

Example represents an Example object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#example-object

type ExternalDocumentation

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

ExternalDocumentation represents an External Documentation object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#external-documentation-object

type Header struct {
	Description      string        `json:"description,omitempty"`
	Type             string        `json:"type,omitempty"`
	Format           string        `json:"format,omitempty"`
	Items            *Items        `json:"items,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"`
	Pattern          string        `json:"pattern,omitempty"`
	MaxItems         int           `json:"maxItems,omitempty"`
	MinItems         int           `json:"minItems,omitempty"`
	UniqueItems      bool          `json:"uniqueItems,omitempty"`
	Enum             []interface{} `json:"enum,omitempty"`
	MultipleOf       int           `json:"multipleOf,omitempty"`
}

Header represents a Header object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#header-object

type Info

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

Info represents an Info object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#info-object

type Items

type Items struct {
	Type             string        `json:"type,omitempty"`
	Format           string        `json:"format,omitempty"`
	Items            *Items        `json:"items,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"`
	Pattern          string        `json:"pattern,omitempty"`
	MaxItems         int           `json:"maxItems,omitempty"`
	MinItems         int           `json:"minItems,omitempty"`
	UniqueItems      bool          `json:"uniqueItems,omitempty"`
	Enum             []interface{} `json:"enum,omitempty"`
	MultipleOf       int           `json:"multipleOf,omitempty"`
}

Items represents an Items object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#items-object

type License

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

License represents a License object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#license-object

type NameParameter

type NameParameter struct {
	Name      string
	Parameter interface{}
}

NameParameter representes a name and a Parameter

type NameParameters

type NameParameters []NameParameter

NameParameters is a slice of NameParameters

func (NameParameters) MarshalJSON

func (xs NameParameters) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*NameParameters) UnmarshalJSON

func (xs *NameParameters) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler

type NameSchema

type NameSchema struct {
	Name   string
	Schema *Schema
}

NameSchema represents a name and a Schema

type NameSchemas

type NameSchemas []NameSchema

NameSchemas is a slice of NameSchemas

func (NameSchemas) MarshalJSON

func (xs NameSchemas) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*NameSchemas) UnmarshalJSON

func (xs *NameSchemas) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler

type Operation

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

	LongRunningOperation bool                 `json:"x-ms-long-running-operation,omitempty"`
	Examples             map[string]Reference `json:"x-ms-examples,omitempty"`
	Pageable             *Pageable            `json:"x-ms-pageable,omitempty"`
}

Operation represents an Operation object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#operation-object

type Pageable

type Pageable struct {
	NextLinkName string `json:"nextLinkName,omitempty"`
}

Pageable represents a Pageable object

type Parameter

type Parameter struct {
	Name             string        `json:"name,omitempty"`
	In               string        `json:"in,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"`
	AllowEmptyValue  bool          `json:"allowEmptyValue,omitempty"`
	Items            *Items        `json:"items,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"`
	Pattern          string        `json:"pattern,omitempty"`
	MaxItems         int           `json:"maxItems,omitempty"`
	MinItems         int           `json:"minItems,omitempty"`
	UniqueItems      bool          `json:"uniqueItems,omitempty"`
	Enum             []interface{} `json:"enum,omitempty"`
	MultipleOf       int           `json:"multipleOf,omitempty"`
}

Parameter represents a Parameter object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameter-object

type ParametersDefinitions

type ParametersDefinitions map[string]*Parameter

ParametersDefinitions represents a Parameters Definitions object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameters-definitions-object

type PathItem

type PathItem 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"`
	Parameters []interface{} `json:"parameters,omitempty"`
}

PathItem represents a Path Item object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#path-item-object

type Reference

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

Reference represents a Reference object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#reference-object

type Response

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

Response represents a Response object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#response-object

type Responses

type Responses map[string]interface{}

Responses represents a Responses object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#responses-object

type ResponsesDefinitions

type ResponsesDefinitions map[string]*Response

ResponsesDefinitions represents a Responses Definitions object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#responses-definitions-object

type Schema

type Schema struct {
	Ref                  string                 `json:"$ref,omitempty"`
	Format               string                 `json:"format,omitempty"`
	Title                string                 `json:"title,omitempty"`
	Description          string                 `json:"description,omitempty"`
	Default              interface{}            `json:"default,omitempty"`
	MultipleOf           int                    `json:"multipleOf,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"`
	Pattern              string                 `json:"pattern,omitempty"`
	MaxItems             int                    `json:"maxItems,omitempty"`
	MinItems             int                    `json:"minItems,omitempty"`
	UniqueItems          bool                   `json:"uniqueItems,omitempty"`
	MaxProperties        int                    `json:"maxProperties,omitempty"`
	MinProperties        int                    `json:"minProperties,omitempty"`
	Required             bool                   `json:"required,omitempty"`
	Enum                 []interface{}          `json:"enum,omitempty"`
	Type                 string                 `json:"type,omitempty"`
	Items                *Schema                `json:"items,omitempty"`
	AllOf                []Schema               `json:"allOf,omitempty"`
	Properties           NameSchemas            `json:"properties,omitempty"`
	AdditionalProperties *Schema                `json:"additionalProperties,omitempty"`
	Discriminator        string                 `json:"discriminator,omitempty"`
	ReadOnly             bool                   `json:"readOnly,omitempty"`
	XML                  *XML                   `json:"xml,omitempty"`
	ExternalDocs         *ExternalDocumentation `json:"externalDocs,omitempty"`
	Example              interface{}            `json:"example,omitempty"`

	ClientFlatten bool `json:"x-ms-client-flatten,omitempty"`
}

Schema represents a Schema object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schema-object

type SecurityDefinitions

type SecurityDefinitions map[string]*SecurityScheme

SecurityDefinitions represents a Security Definitions object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#security-definitions-object

type SecurityRequirement

type SecurityRequirement map[string][]string

SecurityRequirement represents a Security Requirement object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#security-requirement-object

type SecurityScheme

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

SecurityScheme represents a Security Scheme object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#security-scheme-object

type Swagger

type Swagger struct {
	Swagger             string                 `json:"swagger,omitempty"`
	Info                *Info                  `json:"info,omitempty"`
	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,omitempty"`
	Definitions         Definitions            `json:"definitions,omitempty"`
	Parameters          ParametersDefinitions  `json:"parameters,omitempty"`
	Responses           ResponsesDefinitions   `json:"responses,omitempty"`
	SecurityDefinitions SecurityDefinitions    `json:"securityDefinitions,omitempty"`
	Security            []SecurityRequirement  `json:"security,omitempty"`
	Tags                []*Tag                 `json:"tags,omitempty"`
	ExternalDocs        *ExternalDocumentation `json:"externalDocs,omitempty"`
}

Swagger represents a Swagger object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swagger-object

type Tag

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

Tag represents a Tag object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#tag-object

type XML

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

XML represents an XML object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#xml-object

Jump to

Keyboard shortcuts

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