oas

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package oas represents OpenAPI v3 Specification in Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Example added in v0.10.1

type Example struct {
	Ref           string          `json:"$ref,omitempty"` // ref object
	Summary       string          `json:"summary,omitempty"`
	Description   string          `json:"description,omitempty"`
	Value         json.RawMessage `json:"value,omitempty"`
	ExternalValue string          `json:"externalValue,omitempty"`
}

Example is an OpenAPI Example.

type OAuthFlow added in v0.19.0

type OAuthFlow struct {
	AuthorizationURL string
	TokenURL         string
	RefreshURL       string
	Scopes           map[string]string // name -> description
}

OAuthFlow is configuration details for a supported OAuth Flow.

type OAuthFlows added in v0.19.0

type OAuthFlows struct {
	Implicit          *OAuthFlow
	Password          *OAuthFlow
	ClientCredentials *OAuthFlow
	AuthorizationCode *OAuthFlow
}

OAuthFlows allows configuration of the supported OAuth Flows.

type Operation

type Operation struct {
	OperationID string // optional
	Description string // optional
	HTTPMethod  string
	Path        Path
	Parameters  []*Parameter
	RequestBody *RequestBody // optional

	// Security requirements.
	Security []SecurityRequirements

	// Operation responses.
	// Map is always non-nil.
	//
	// Key can be:
	//  * HTTP Status code
	//  * default
	//  * 1XX, 2XX, 3XX, 4XX, 5XX
	Responses map[string]*Response
}

Operation is an OpenAPI Operation.

type Parameter

type Parameter struct {
	Name        string
	Description string
	Schema      *jsonschema.Schema

	In       ParameterLocation
	Style    ParameterStyle
	Explode  bool
	Required bool
}

Parameter is an OpenAPI Operation Parameter.

type ParameterLocation

type ParameterLocation string

ParameterLocation defines where OpenAPI parameter is located.

const (
	LocationQuery  ParameterLocation = "query"
	LocationHeader ParameterLocation = "header"
	LocationPath   ParameterLocation = "path"
	LocationCookie ParameterLocation = "cookie"
)

func (ParameterLocation) Cookie

func (l ParameterLocation) Cookie() bool

func (ParameterLocation) Header

func (l ParameterLocation) Header() bool

func (ParameterLocation) Path

func (l ParameterLocation) Path() bool

func (ParameterLocation) Query

func (l ParameterLocation) Query() bool

type ParameterStyle added in v0.10.0

type ParameterStyle string
const (
	PathStyleSimple ParameterStyle = "simple"
	PathStyleLabel  ParameterStyle = "label"
	PathStyleMatrix ParameterStyle = "matrix"

	QueryStyleForm           ParameterStyle = "form"
	QueryStyleSpaceDelimited ParameterStyle = "spaceDelimited"
	QueryStylePipeDelimited  ParameterStyle = "pipeDelimited"
	QueryStyleDeepObject     ParameterStyle = "deepObject"

	HeaderStyleSimple ParameterStyle = "simple"

	CookieStyleForm ParameterStyle = "form"
)

https://swagger.io/docs/specification/serialization/

func (ParameterStyle) String added in v0.10.0

func (s ParameterStyle) String() string

type Path added in v0.5.0

type Path []PathPart

func (Path) String added in v0.5.0

func (p Path) String() (path string)

type PathPart

type PathPart struct {
	Raw   string
	Param *Parameter
}

PathPart is a part of an OpenAPI Operation Path.

type RequestBody

type RequestBody struct {
	Contents map[string]*jsonschema.Schema
	Required bool
}

RequestBody of an OpenAPI Operation.

type Response

type Response struct {
	Ref      string
	Contents map[string]*jsonschema.Schema
}

Response is an OpenAPI Response definition.

type Security added in v0.19.0

type Security struct {
	Type             string
	Description      string
	Name             string
	In               string
	Scheme           string
	BearerFormat     string
	Flows            OAuthFlows
	OpenIDConnectURL string
}

type SecurityRequirements added in v0.19.0

type SecurityRequirements struct {
	Scopes   []string
	Name     string
	Security Security
}

type Spec added in v0.19.0

type Spec struct {
	Operations []*Operation
}

Spec is an OpenAPI specification.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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