oas

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 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 Operation

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

	// 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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