v2

package
v0.0.0-...-1b9b9d2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiKeyLocation

type ApiKeyLocation string
const (
	ApiKeyLocation_Query  ApiKeyLocation = "query"
	ApiKeyLocation_Header ApiKeyLocation = "header"
)

type CollectionFormat

type CollectionFormat string
const (
	CollectionFormat_Csv   CollectionFormat = "csv"
	CollectionFormat_Ssv   CollectionFormat = "ssv"
	CollectionFormat_Tsv   CollectionFormat = "tsv"
	CollectionFormat_Pipes CollectionFormat = "pipes"
	CollectionFormat_Multi CollectionFormat = "multi"
)

type Contact

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

type Definitions

type Definitions map[string]Schema

type Example

type Example map[string]interface{}

type ExternalDoc

type ExternalDoc struct {
	Url         string `json:"url" yaml:"url"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
}
type Header struct {
	Description      string           `json:"description,omitempty" yaml:"description,omitempty"`
	Type             HeaderType       `json:"type,omitempty" yaml:"type,omitempty"`
	Format           TypeFormat       `json:"format,omitempty" yaml:"format,omitempty"`
	Items            *Items           `json:"items,omitempty" yaml:"items,omitempty"`
	CollectionFormat CollectionFormat `json:"collectionFormat,omitempty" yaml:"collectionFormat,omitempty"`
	Default          interface{}      `json:"default,omitempty" yaml:"default,omitempty"`
	Minimum          float64          `json:"minimum,omitempty" yaml:"minimum,omitempty"`
	Maximum          float64          `json:"maximum,omitempty" yaml:"maximum,omitempty"`
	ExclusiveMinimum float64          `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"`
	ExclusiveMaximum float64          `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"`
	MinLength        int              `json:"minLength,omitempty" yaml:"minLength,omitempty"`
	MaxLength        int              `json:"maxLength,omitempty" yaml:"maxLength,omitempty"`
	Pattern          string           `json:"pattern,omitempty" yaml:"pattern,omitempty"`
	MinItems         int              `json:"minItems,omitempty" yaml:"minItems,omitempty"`
	MaxItems         int              `json:"maxItems,omitempty" yaml:"maxItems,omitempty"`
	UniqueItems      bool             `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"`
	Enum             []interface{}    `json:"enum,omitempty" yaml:"enum,omitempty"`
	MultipleOf       float64          `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"`
}

type HeaderType

type HeaderType string
const (
	HeaderType_String  HeaderType = "string"
	HeaderType_Number  HeaderType = "number"
	HeaderType_Integer HeaderType = "integer"
	HeaderType_Boolean HeaderType = "boolean"
	HeaderType_Array   HeaderType = "array"
)

type Headers

type Headers map[string]Header

type Info

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

type Items

type Items struct {
	Type             ItemsType        `json:"type,omitempty" yaml:"type,omitempty"`
	Format           TypeFormat       `json:"format,omitempty" yaml:"format,omitempty"`
	Items            *Items           `json:"items,omitempty" yaml:"items,omitempty"`
	CollectionFormat CollectionFormat `json:"collectionFormat,omitempty" yaml:"collectionFormat,omitempty"`
	Default          interface{}      `json:"default,omitempty" yaml:"default,omitempty"`
	Minimum          float64          `json:"minimum,omitempty" yaml:"minimum,omitempty"`
	Maximum          float64          `json:"maximum,omitempty" yaml:"maximum,omitempty"`
	ExclusiveMinimum float64          `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"`
	ExclusiveMaximum float64          `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"`
	MinLength        int              `json:"minLength,omitempty" yaml:"minLength,omitempty"`
	MaxLength        int              `json:"maxLength,omitempty" yaml:"maxLength,omitempty"`
	Pattern          string           `json:"pattern,omitempty" yaml:"pattern,omitempty"`
	MinItems         int              `json:"minItems,omitempty" yaml:"minItems,omitempty"`
	MaxItems         int              `json:"maxItems,omitempty" yaml:"maxItems,omitempty"`
	UniqueItems      bool             `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"`
	Enum             []interface{}    `json:"enum,omitempty" yaml:"enum,omitempty"`
	MultipleOf       float64          `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"`
}

type ItemsType

type ItemsType string
const (
	ItemsType_String  ItemsType = "string"
	ItemsType_Number  ItemsType = "number"
	ItemsType_Integer ItemsType = "integer"
	ItemsType_Boolean ItemsType = "boolean"
	ItemsType_Array   ItemsType = "array"
)
const (
	SchemaType_Null    ItemsType = "null"
	SchemaType_String  ItemsType = "string"
	SchemaType_Number  ItemsType = "number"
	SchemaType_Integer ItemsType = "integer"
	SchemaType_Boolean ItemsType = "boolean"
	SchemaType_Array   ItemsType = "array"
	SchemaType_Object  ItemsType = "object"
)

type License

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

type OAuth2Flow

type OAuth2Flow string
const (
	OAuth2Flow_Implicit    OAuth2Flow = "implicit"
	OAuth2Flow_Password    OAuth2Flow = "password"
	OAuth2Flow_Application OAuth2Flow = "application"
	OAuth2Flow_AccessCode  OAuth2Flow = "accessCode"
)

type OAuth2Scopes

type OAuth2Scopes map[string]string

type Operation

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

type Parameter

type Parameter struct {
	Reference

	Name             string              `json:"name,omitempty" yaml:"name,omitempty"`
	In               ParameterLocation   `json:"in,omitempty" yaml:"in,omitempty"`
	Description      string              `json:"description,omitempty" yaml:"description,omitempty"`
	Required         bool                `json:"required,omitempty" yaml:"required,omitempty"`
	Schema           *Schema             `json:"schema,omitempty" yaml:"schema,omitempty"`
	Type             SimpleParameterType `json:"type,omitempty" yaml:"type,omitempty"`
	Format           TypeFormat          `json:"format,omitempty" yaml:"format,omitempty"`
	AllowEmptyValue  bool                `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"`
	Items            *Items              `json:"items,omitempty" yaml:"items,omitempty"`
	CollectionFormat CollectionFormat    `json:"collectionFormat,omitempty" yaml:"collectionFormat,omitempty"`
	Default          interface{}         `json:"default,omitempty" yaml:"default,omitempty"`
	Minimum          float64             `json:"minimum,omitempty" yaml:"minimum,omitempty"`
	Maximum          float64             `json:"maximum,omitempty" yaml:"maximum,omitempty"`
	ExclusiveMinimum float64             `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"`
	ExclusiveMaximum float64             `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"`
	MinLength        int                 `json:"minLength,omitempty" yaml:"minLength,omitempty"`
	MaxLength        int                 `json:"maxLength,omitempty" yaml:"maxLength,omitempty"`
	Pattern          string              `json:"pattern,omitempty" yaml:"pattern,omitempty"`
	MinItems         int                 `json:"minItems,omitempty" yaml:"minItems,omitempty"`
	MaxItems         int                 `json:"maxItems,omitempty" yaml:"maxItems,omitempty"`
	UniqueItems      bool                `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"`
	Enum             []interface{}       `json:"enum,omitempty" yaml:"enum,omitempty"`
	MultipleOf       float64             `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"`
}

type ParameterLocation

type ParameterLocation string
const (
	ParameterLocation_Query    ParameterLocation = "query"
	ParameterLocation_Header   ParameterLocation = "header"
	ParameterLocation_Path     ParameterLocation = "path"
	ParameterLocation_FormData ParameterLocation = "formData"
	ParameterLocation_Body     ParameterLocation = "body"
)

type Parameters

type Parameters []Parameter

type PathItem

type PathItem struct {
	Reference

	Get        *Operation `json:"get,omitempty" yaml:"get,omitempty"`
	Put        *Operation `json:"put,omitempty" yaml:"put,omitempty"`
	Post       *Operation `json:"post,omitempty" yaml:"post,omitempty"`
	Delete     *Operation `json:"delete,omitempty" yaml:"delete,omitempty"`
	Options    *Operation `json:"options,omitempty" yaml:"options,omitempty"`
	Head       *Operation `json:"head,omitempty" yaml:"head,omitempty"`
	Patch      *Operation `json:"patch,omitempty" yaml:"patch,omitempty"`
	Parameters Parameters `json:"parameters,omitempty" yaml:"parameters,omitempty"`
}

type Paths

type Paths map[string]PathItem

type Reference

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

type Response

type Response struct {
	Reference

	Description string   `json:"description,omitempty" yaml:"description,omitempty"`
	Schema      *Schema  `json:"schema,omitempty" yaml:"schema,omitempty"`
	Headers     Headers  `json:"headers,omitempty" yaml:"headers,omitempty"`
	Examples    *Example `json:"example,omitempty" yaml:"example,omitempty"`
}

type Responses

type Responses map[string]Response

type Schema

type Schema struct {
	Reference

	Title                string            `json:"title,omitempty" yaml:"title,omitempty"`
	Type                 SchemaType        `json:"type,omitempty" yaml:"type,omitempty"`
	Format               TypeFormat        `json:"format,omitempty" yaml:"format,omitempty"`
	Items                *Items            `json:"items,omitempty" yaml:"items,omitempty"`
	CollectionFormat     CollectionFormat  `json:"collectionFormat,omitempty" yaml:"collectionFormat,omitempty"`
	Default              interface{}       `json:"default,omitempty" yaml:"default,omitempty"`
	Minimum              float64           `json:"minimum,omitempty" yaml:"minimum,omitempty"`
	Maximum              float64           `json:"maximum,omitempty" yaml:"maximum,omitempty"`
	ExclusiveMinimum     float64           `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"`
	ExclusiveMaximum     float64           `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"`
	MinLength            int               `json:"minLength,omitempty" yaml:"minLength,omitempty"`
	MaxLength            int               `json:"maxLength,omitempty" yaml:"maxLength,omitempty"`
	Pattern              string            `json:"pattern,omitempty" yaml:"pattern,omitempty"`
	MinItems             int               `json:"minItems,omitempty" yaml:"minItems,omitempty"`
	MaxItems             int               `json:"maxItems,omitempty" yaml:"maxItems,omitempty"`
	UniqueItems          bool              `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"`
	Enum                 []interface{}     `json:"enum,omitempty" yaml:"enum,omitempty"`
	MultipleOf           float64           `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"`
	Required             []string          `json:"required,omitempty" yaml:"required,omitempty"`
	AllOf                []Schema          `json:"allOf,omitempty" yaml:"allOf,omitempty"`
	Properties           map[string]Scheme `json:"properties,omitempty" yaml:"properties,omitempty"`
	AdditionalProperties *Schema           `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"`
	Discriminator        string            `json:"discrimator,omitempty" yaml:"discrimator,omitempty"`
	ReadOnly             bool              `json:"readOnly,omitempty" yaml:"readOnly,omitempty"`
	ExternalDocs         *ExternalDoc      `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
	Example              interface{}       `json:"example,omitempty" yaml:"example,omitempty"`
}

type SchemaType

type SchemaType string

type Scheme

type Scheme string
const (
	Scheme_Http  Scheme = "http"
	Scheme_Https Scheme = "https"
	Scheme_Ws    Scheme = "ws"
	Scheme_Wss   Scheme = "wss"
)

type Security

type Security map[string]string

type SecurityDefinitions

type SecurityDefinitions map[string]SecurityScheme

type SecurityScheme

type SecurityScheme struct {
	Type             SecuritySchemeType `json:"type" yaml:"type"`
	Description      string             `json:"description,omitempty" yaml:"description,omitempty"`
	Name             string             `json:"name,omitempty" yaml:"name,omitempty"`
	In               ApiKeyLocation     `json:"in,omitempty" yaml:"in,omitempty"`
	Flow             OAuth2Flow         `json:"flow,omitempty" yaml:"flow,omitempty"`
	AuthorizationUrl string             `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"`
	TokenUrl         string             `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"`
	Scopes           *OAuth2Scopes      `json:"scopes,omitempty" yaml:"scopes,omitempty"`
}

type SecuritySchemeType

type SecuritySchemeType string
const (
	SecuritySchemeType_Basic  SecuritySchemeType = "basic"
	SecuritySchemeType_ApiKey SecuritySchemeType = "apiKey"
	SecuritySchemeType_OAuth2 SecuritySchemeType = "oauth2"
)

type SimpleParameterType

type SimpleParameterType string
const (
	SimpleParameterType_String  SimpleParameterType = "string"
	SimpleParameterType_Number  SimpleParameterType = "number"
	SimpleParameterType_Integer SimpleParameterType = "integer"
	SimpleParameterType_Boolean SimpleParameterType = "boolean"
	SimpleParameterType_Array   SimpleParameterType = "array"
	SimpleParameterType_File    SimpleParameterType = "file"
)

type Specification

type Specification struct {
	Swagger             string              `json:"swagger" yaml:"swagger"`
	Info                Info                `json:"info" yaml:"info"`
	Host                string              `json:"host,omitempty" yaml:"host,omitempty"`
	BasePath            string              `json:"basePath,omitempty" yaml:"basePath,omitempty"`
	Schemes             []Scheme            `json:"schemes,omitempty" yaml:"schemes,omitempty"`
	Consumes            []string            `json:"consumes,omitempty" yaml:"consumes,omitempty"`
	Produces            []string            `json:"produces,omitempty" yaml:"produces,omitempty"`
	Paths               Paths               `json:"paths" yaml:"paths"`
	Definitions         *Definitions        `json:"definitions,omitempty" yaml:"definitions,omitempty"`
	Parameters          Parameters          `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Responses           Responses           `json:"responses,omitempty" yaml:"responses,omitempty"`
	SecurityDefinitions SecurityDefinitions `json:"securityDefinitions,omitempty" yaml:"securityDefinitions,omitempty"`
	Security            []Security          `json:"security,omitempty" yaml:"security,omitempty"`
	Tags                []Tag               `json:"tags,omitempty" yaml:"tags,omitempty"`
	ExternalDocs        *ExternalDoc        `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
}

func ParseJSON

func ParseJSON(text string) (*Specification, error)

func ParseYAML

func ParseYAML(text string) (*Specification, error)

func (Specification) JSON

func (s Specification) JSON(indent bool) string

func (Specification) YAML

func (s Specification) YAML() string

type Tag

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

type TypeFormat

type TypeFormat string
const (
	TypeFormat_Int32    TypeFormat = "int32"
	TypeFormat_Int64    TypeFormat = "int64"
	TypeFormat_Float    TypeFormat = "float"
	TypeFormat_Double   TypeFormat = "double"
	TypeFormat_Byte     TypeFormat = "byte"
	TypeFormat_Binary   TypeFormat = "binary"
	TypeFormat_Date     TypeFormat = "date"
	TypeFormat_DateTime TypeFormat = "date-time"
	TypeFormat_Password TypeFormat = "password"
)

Jump to

Keyboard shortcuts

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