specification

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	Spec *openapi3.Header
	Ref  string

	Name      string
	SchemaRef *openapi3.SchemaRef

	Description string
	Required    bool
	Deprecated  bool
}

func Headers

func Headers(hs openapi3.Headers) (out []Header)

func NewHeader

func NewHeader(name string, h *openapi3.HeaderRef) Header

type HeaderParameter

type HeaderParameter struct {
	RefName     string
	Name        string
	Description string
	Required    bool
	Schema      Schema
}

type Operation

type Operation struct {
	PathItem *PathItem

	HTTPMethod string
	Method     string
	Operation  *openapi3.Operation

	Parameters struct {
		Path    PathParameters
		Query   []QueryParameter
		Headers []*HeaderParameter
	}

	DefaultResponse *Response
	Responses       []*Response
}

func NewOperation

func NewOperation(pi *PathItem, method httpMethod, operation *openapi3.Operation) *Operation

type Path

type Path struct {
	Spec   string
	Dirs   []*PathDir
	Params PathParameters
}

func NewPath

func NewPath(s string) (zero Path, _ error)

type PathDir

type PathDir struct {
	Raw      Prefix
	ParamRef *PathParameter
}

type PathItem

type PathItem struct {
	Path     Path
	PathOld  PathOld
	PathItem *openapi3.PathItem
	Spec     *Spec

	Operations []*Operation
}

type PathOld

type PathOld string

PathOld always starts with '/'

func NewPathOld

func NewPathOld(s string) (PathOld, error)

func (PathOld) Cut

func (p PathOld) Cut() (Prefix, PathOld, bool)

func (PathOld) Name

func (p PathOld) Name(fn func(Prefix) string, sep string) string

func (PathOld) String

func (p PathOld) String() string

type PathParameter

type PathParameter struct {
	RefName     string
	Name        string
	Description string
	Schema      Schema
}

type PathParameters

type PathParameters []*PathParameter

func (PathParameters) Get

func (ps PathParameters) Get(name string) (*PathParameter, bool)

type Prefix

type Prefix string

Prefix always starts with '/'

func (Prefix) IsVariable

func (p Prefix) IsVariable() bool

func (Prefix) Name

func (p Prefix) Name() string

type QueryParameter

type QueryParameter struct {
	RefName     string
	Name        string
	Description string
	Required    bool
	Schema      Schema
}

type Response

type Response struct {
	StatusCode string
	Operation  *Operation
	Spec       *openapi3.Response

	RefName string
	Headers []Header
}

func NewResponse

func NewResponse(responseStatusCode string, o *Operation, r *openapi3.ResponseRef) *Response

type Schema

type Schema struct {
	Ref    string
	Schema *openapi3.Schema
	Items  *Schema
}

func NewSchema

func NewSchema(schema *openapi3.SchemaRef) Schema

type Spec

type Spec struct {
	Swagger *openapi3.Swagger

	Paths      []*PathItem
	Operations []*Operation
}

func ParseSwagger

func ParseSwagger(spec *openapi3.Swagger) (*Spec, error)

Jump to

Keyboard shortcuts

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