spec

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Components

type Components struct {
	Schemas         map[string]*Schema        `json:"schemas"`
	Responses       map[string]*Response      `json:"responses"`
	Parameters      map[string]Parameter      `json:"parameters"`
	SecuritySchemes map[string]SecurityScheme `json:"securitySchemes,omitempty"`
}

type Contact

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

type Content

type Content map[MediaType]MediaTypeObject

type Edge

type Edge struct {
	Schema Schema  `json:"schema"`
	Ref    *Schema `json:"-"`
	Unique bool    `json:"-"`
}

func (Edge) MarshalJSON

func (e Edge) MarshalJSON() ([]byte, error)

type Edges

type Edges map[string]Edge

type ExternalDocs

type ExternalDocs struct {
	Description string `json:"description"`
	URL         string `json:"url"`
}

type Field

type Field struct {
	Type
	Unique   bool        `json:"-"`
	Required bool        `json:"-"`
	Example  interface{} `json:"example,omitempty"`
}

func (Field) MarshalJSON

func (f Field) MarshalJSON() ([]byte, error)

type Fields

type Fields map[string]*Field

type Info

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

type License

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

type MediaType

type MediaType string
const JSON MediaType = "application/json"

type MediaTypeObject

type MediaTypeObject struct {
	Unique bool    `json:"-"`
	Ref    *Schema `json:"-"`
	Schema Schema  `json:"schema"`
}

func (MediaTypeObject) MarshalJSON

func (o MediaTypeObject) MarshalJSON() ([]byte, error)

type OAuthFlow

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

type OAuthFlows

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

type Operation

type Operation struct {
	Summary      string                        `json:"summary,omitempty"`
	Description  string                        `json:"description,omitempty"`
	Tags         []string                      `json:"tags,omitempty"`
	ExternalDocs *ExternalDocs                 `json:"externalDocs,omitempty"`
	OperationID  string                        `json:"operationId"`
	Parameters   []*Parameter                  `json:"parameters,omitempty"`
	RequestBody  *RequestBody                  `json:"requestBody,omitempty"`
	Responses    map[string]*OperationResponse `json:"responses"`
	Deprecated   bool                          `json:"deprecated,omitempty"`
	Security     Security                      `json:"security,omitempty"`
}

type OperationResponse

type OperationResponse struct {
	Ref      *Response
	Response Response
}

func (OperationResponse) MarshalJSON

func (r OperationResponse) MarshalJSON() ([]byte, error)

type Parameter

type Parameter struct {
	Name            string         `json:"name"`
	In              ParameterPlace `json:"in"`
	Description     string         `json:"description,omitempty"`
	Required        bool           `json:"required,omitempty"`
	Deprecated      bool           `json:"deprecated,omitempty"`
	AllowEmptyValue bool           `json:"allowEmptyValue,omitempty"`
	Schema          Type           `json:"schema"`
}

type ParameterPlace

type ParameterPlace uint

ParameterPlace denotes where to find a parameter in the request.

const (
	InQuery ParameterPlace = iota
	InHeader
	InPath
	InCookie
)

func (ParameterPlace) MarshalJSON

func (p ParameterPlace) MarshalJSON() ([]byte, error)

func (*ParameterPlace) UnmarshalJSON

func (p *ParameterPlace) UnmarshalJSON(d []byte) error

type Path

type Path struct {
	Get        *Operation  `json:"get,omitempty"`
	Post       *Operation  `json:"post,omitempty"`
	Delete     *Operation  `json:"delete,omitempty"`
	Patch      *Operation  `json:"patch,omitempty"`
	Parameters []Parameter `json:"parameters,omitempty"`
}

type RequestBody

type RequestBody struct {
	Description string  `json:"description"`
	Content     Content `json:"content"`
}

type Response

type Response struct {
	Name        string               `json:"-"`
	Description string               `json:"description"`
	Headers     map[string]Parameter `json:"headers,omitempty"`
	Content     *Content             `json:"content,omitempty"`
}

type Schema

type Schema struct {
	Name   string
	Fields Fields
	Edges  Edges
}

func (Schema) MarshalJSON

func (s Schema) MarshalJSON() ([]byte, error)

type Security

type Security []map[string][]string

type SecurityScheme

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

type Spec

type Spec struct {
	Info         *Info            `json:"info"`
	Tags         []Tag            `json:"tags,omitempty"`
	Paths        map[string]*Path `json:"paths"`
	Components   Components       `json:"components"`
	Security     Security         `json:"security,omitempty"`
	ExternalDocs *ExternalDocs    `json:"externalDocs,omitempty"`
}

Spec represents a OAS.

func (Spec) MarshalJSON

func (spec Spec) MarshalJSON() ([]byte, error)

type Tag

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

type Type

type Type struct {
	Type   string `json:"type,omitempty"`
	Format string `json:"format,omitempty"`
	Items  *Type  `json:"items,omitempty"`
}

Jump to

Keyboard shortcuts

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