v3

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 Callback

type Callback map[string]PathItem

type Components

type Components struct {
	Schemas         map[string]Schema         `json:"schemas,omitempty" yaml:"schemas,omitempty"`
	Responses       map[string]Response       `json:"responses,omitempty" yaml:"responses,omitempty"`
	Parameters      map[string]Parameter      `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Examples        map[string]Example        `json:"examples,omitempty" yaml:"examples,omitempty"`
	RequestBodies   map[string]RequestBody    `json:"requestBodies,omitempty" yaml:"requestBodies,omitempty"`
	Headers         map[string]Header         `json:"headers,omitempty" yaml:"headers,omitempty"`
	SecuritySchemes map[string]SecurityScheme `json:"securityScheme,omitempty" yaml:"securityScheme,omitempty"`
	Links           map[string]Link           `json:"links,omitempty" yaml:"links,omitempty"`
	Callbacks       map[string]Callback       `json:"callbacks,omitempty" yaml:"callbacks,omitempty"`
}

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 Discriminator

type Discriminator struct {
	PropertyName string            `json:"propertyName" yaml:"propertyName"`
	Mapping      map[string]string `json:"mapping" yaml:"mapping"`
}

type Encoding

type Encoding struct {
	ContentType   string            `json:"contentType,omitempty" yaml:"contentType,omitempty"`
	Headers       map[string]Header `json:"headers,omitempty" yaml:"headers,omitempty"`
	Style         string            `json:"style,omitempty" yaml:"style,omitempty"`
	Explode       bool              `json:"explode,omitempty" yaml:"explode,omitempty"`
	AllowReserved string            `json:"allowReserved,omitempty" yaml:"allowReserved,omitempty"`
}

type Example

type Example struct {
	Reference

	Summary       string      `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description   string      `json:"description,omitempty" yaml:"description,omitempty"`
	Value         interface{} `json:"value,omitempty" yaml:"value,omitempty"`
	ExternalValue string      `json:"externalValue,omitempty" yaml:"externalValue,omitempty"`
}

type ExternalDoc

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

	Description     string               `json:"description,omitempty" yaml:"description,omitempty"`
	Required        bool                 `json:"required,omitempty" yaml:"required,omitempty"`
	Deprecated      bool                 `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
	AllowEmptyValue bool                 `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"`
	Style           string               `json:"style,omitempty" yaml:"style,omitempty"`
	Explode         bool                 `json:"explode,omitempty" yaml:"explode,omitempty"`
	AllowReserved   bool                 `json:"allowReserved,omitempty" yaml:"allowReserved,omitempty"`
	Schema          *Schema              `json:"schema,omitempty" yaml:"schema,omitempty"`
	Example         interface{}          `json:"example,omitempty" yaml:"example,omitempty"`
	Examples        map[string]Example   `json:"examples,omitempty" yaml:"examples,omitempty"`
	Content         map[string]MediaType `json:"content,omitempty" yaml:"content,omitempty"`
}

type Info

type Info struct {
	Title          string   `json:"title" yaml:"title"`
	Version        string   `json:"version" yaml:"version"`
	Description    string   `json:"description,omitempty" yaml:"description,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 License

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

	Description  string      `json:"description,omitempty" yaml:"description,omitempty"`
	OperationRef string      `json:"operationRef,omitempty" yaml:"operationRef,omitempty"`
	OperationId  string      `json:"operationId,omitempty" yaml:"operationId,omitempty"`
	Parameters   interface{} `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	RequestBody  interface{} `json:"requestBody,omitempty" yaml:"requestBody,omitempty"`
	Server       *Server     `json:"server,omitempty" yaml:"server,omitempty"`
}

type MediaType

type MediaType struct {
	Schema   *Schema             `json:"schema,omitempty" yaml:"schema,omitempty"`
	Example  interface{}         `json:"example,omitempty" yaml:"example,omitempty"`
	Examples map[string]Example  `json:"examples,omitempty" yaml:"examples,omitempty"`
	Encoding map[string]Encoding `json:"encoding,omitempty" yaml:"encoding,omitempty"`
}

type OAuthFlow

type OAuthFlow struct {
	AuthorizationUrl string            `json:"authorizationUrl" yaml:"authorizationUrl"`
	TokenUrl         string            `json:"tokenUrl" yaml:"tokenUrl"`
	RefreshUrl       string            `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty"`
	Scopes           map[string]string `json:"scopes" yaml:"scopes"`
}

type OAuthFlows

type OAuthFlows struct {
	Implicit          *OAuthFlow `json:"implicit,omitempty" yaml:"implicit,omitempty"`
	Password          *OAuthFlow `json:"password,omitempty" yaml:"password,omitempty"`
	ClientCredentials *OAuthFlow `json:"clientCredentials,omitempty" yaml:"clientCredentials,omitempty"`
	AuthorizationCode *OAuthFlow `json:"authorizationCode,omitempty" yaml:"authorizationCode,omitempty"`
}

type Operation

type Operation struct {
	Tags         []string            `json:"tags,omitempty" yaml:"tags,omitempty"`
	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"`
	Parameters   []Parameter         `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	RequestBody  *RequestBody        `json:"requestBody,omitempty" yaml:"requestBody,omitempty"`
	Responses    Responses           `json:"responses" yaml:"responses"`
	Callbacks    map[string]Callback `json:"callbacks,omitempty" yaml:"callbacks,omitempty"`
	Deprecated   bool                `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
	Security     []Security          `json:"security,omitempty" yaml:"security,omitempty"`
	Servers      []Server            `json:"servers,omitempty" yaml:"servers,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"`
	Deprecated      bool                 `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
	AllowEmptyValue bool                 `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"`
	Style           string               `json:"style,omitempty" yaml:"style,omitempty"`
	Explode         bool                 `json:"explode,omitempty" yaml:"explode,omitempty"`
	AllowReserved   bool                 `json:"allowReserved,omitempty" yaml:"allowReserved,omitempty"`
	Schema          *Schema              `json:"schema,omitempty" yaml:"schema,omitempty"`
	Example         interface{}          `json:"example,omitempty" yaml:"example,omitempty"`
	Examples        map[string]Example   `json:"examples,omitempty" yaml:"examples,omitempty"`
	Content         map[string]MediaType `json:"content,omitempty" yaml:"content,omitempty"`
}

type ParameterLocation

type ParameterLocation string
const (
	ParameterLocation_Query  ParameterLocation = "query"
	ParameterLocation_Header ParameterLocation = "header"
	ParameterLocation_Path   ParameterLocation = "path"
	ParameterLocation_Cookie ParameterLocation = "cookie"
)

type PathItem

type PathItem struct {
	Reference

	Summary     string      `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description string      `json:"description,omitempty" yaml:"description,omitempty"`
	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"`
	Trace       *Operation  `json:"trace,omitempty" yaml:"trace,omitempty"`
	Servers     []Server    `json:"servers,omitempty" yaml:"servers,omitempty"`
	Parameters  []Parameter `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 RequestBody

type RequestBody struct {
	Reference

	Content     map[string]MediaType `json:"content,omitempty" yaml:"content,omitempty"`
	Description string               `json:"description,omitempty" yaml:"description,omitempty"`
	Required    bool                 `json:"required,omitempty" yaml:"required,omitempty"`
}

type Response

type Response struct {
	Reference

	Description string               `json:"description,omitempty" yaml:"description,omitempty"`
	Headers     map[string]Header    `json:"headers,omitempty" yaml:"headers,omitempty"`
	Content     map[string]MediaType `json:"content,omitempty" yaml:"content,omitempty"`
	Links       map[string]Link      `json:"links,omitempty" yaml:"links,omitempty"`
}

type Responses

type Responses map[string]Response

type Schema

type Schema struct {
	Reference

	Type                 SchemaType        `json:"type,omitempty" yaml:"type,omitempty"`
	AllOf                []Schema          `json:"allOf,omitempty" yaml:"allOf,omitempty"`
	OneOf                []Schema          `json:"oneOf,omitempty" yaml:"oneOf,omitempty"`
	AnyOf                []Schema          `json:"anyOf,omitempty" yaml:"anyOf,omitempty"`
	Description          string            `json:"description,omitempty" yaml:"description,omitempty"`
	Format               string            `json:"format,omitempty" yaml:"format,omitempty"`
	Required             []string          `json:"required,omitempty" yaml:"required,omitempty"`
	Enum                 []interface{}     `json:"enum,omitempty" yaml:"enum,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"`
	MinItems             int               `json:"minItems,omitempty" yaml:"minItems,omitempty"`
	MaxItems             int               `json:"maxItems,omitempty" yaml:"maxItems,omitempty"`
	Pattern              string            `json:"pattern,omitempty" yaml:"pattern,omitempty"`
	Items                *Schema           `json:"items,omitempty" yaml:"items,omitempty"`
	UniqueItems          bool              `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"`
	Properties           map[string]Schema `json:"properties,omitempty" yaml:"properties,omitempty"`
	AdditionalProperties *Schema           `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"`
	Nullable             bool              `json:"nullable,omitempty" yaml:"nullable,omitempty"`
	Discriminator        *Discriminator    `json:"discrimator,omitempty" yaml:"discrimator,omitempty"`
	ReadOnly             bool              `json:"readOnly,omitempty" yaml:"readOnly,omitempty"`
	WriteOnly            bool              `json:"writeOnly,omitempty" yaml:"writeOnly,omitempty"`
	Example              interface{}       `json:"example,omitempty" yaml:"example,omitempty"`
	Deprecated           bool              `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
}

type SchemaType

type SchemaType string
const (
	SchemaType_Integer SchemaType = "integer"
	SchemaType_Number  SchemaType = "number"
	SchemaType_String  SchemaType = "string"
	SchemaType_Boolean SchemaType = "boolean"
	SchemaType_Object  SchemaType = "object"
	SchemaType_Array   SchemaType = "array"
)

type Security

type Security map[string][]string

type SecurityLocation

type SecurityLocation string
const (
	SecurityLocation_Query  SecurityLocation = "query"
	SecurityLocation_Header SecurityLocation = "header"
	SecurityLocation_Cookie SecurityLocation = "cookie"
)

type SecurityScheme

type SecurityScheme struct {
	Reference

	Type             string           `json:"type,omitempty" yaml:"type,omitempty"`
	Description      string           `json:"description,omitempty" yaml:"description,omitempty"`
	Name             string           `json:"name,omitempty" yaml:"name,omitempty"`
	In               SecurityLocation `json:"in,omitempty" yaml:"in,omitempty"`
	Scheme           string           `json:"scheme,omitempty" yaml:"scheme,omitempty"`
	BearerFormat     string           `json:"bearerFormat,omitempty" yaml:"bearerFormat,omitempty"`
	Flows            *OAuthFlows      `json:"flows,omitempty" yaml:"flows,omitempty"`
	OpenIdConnectUrl string           `json:"openIdConnectUrl,omitempty" yaml:"openIdConnectUrl,omitempty"`
}

type SecuritySchemeType

type SecuritySchemeType string
const (
	SecuritySchemeType_ApiKey        SecuritySchemeType = "apiKey"
	SecuritySchemeType_Http          SecuritySchemeType = "http"
	SecuritySchemeType_OAuth2        SecuritySchemeType = "oauth2"
	SecuritySchemeType_OpenIdConnect SecuritySchemeType = "openIdConnect"
)

type Server

type Server struct {
	Url         string                    `json:"url" yaml:"url"`
	Description string                    `json:"description,omitempty" yaml:"description,omitempty"`
	Variables   map[string]ServerVariable `json:"variables,omitempty" yaml:"variables,omitempty"`
}

type ServerVariable

type ServerVariable struct {
	Enum        []string `json:"enum" yaml:"enum"`
	Default     string   `json:"default" yaml:"default"`
	Description string   `json:"description,omitempty" yaml:"description,omitempty"`
}

type Specification

type Specification struct {
	OpenApi      string       `json:"openapi" yaml:"openapi"`
	Info         Info         `json:"info" yaml:"info"`
	Servers      []Server     `json:"servers,omitempty" yaml:"servers,omitempty"`
	Paths        Paths        `json:"paths" yaml:"paths"`
	Components   *Components  `json:"components,omitempty" yaml:"components,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"`
}

Jump to

Keyboard shortcuts

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