specification

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSecurity added in v0.0.12

func GetSecurity(secSchemes openapi3.SecuritySchemes, secRequirements openapi3.SecurityRequirements) ([][]Security, error)

Types

type ComponentSchema added in v0.0.11

type ComponentSchema struct {
	Name string
	Schema
}

type Components added in v0.0.11

type Components struct {
	Schemas []ComponentSchema
}

func NewComponents added in v0.0.11

func NewComponents(spec openapi3.Components) Components
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 Info added in v0.0.10

type Info struct {
	Title       string
	Description string
	Version     string
}

func NewInfo added in v0.0.10

func NewInfo(s *openapi3.Info) Info

type Operation

type Operation struct {
	PathItem *PathItem

	HTTPMethod  string
	Method      string
	OperationID string

	Operation *openapi3.Operation

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

	Security [][]Security

	DefaultResponse *Response
	Responses       []*Response
}

func NewOperation

func NewOperation(pi *PathItem, method httpMethod, operation *openapi3.Operation, specSecurityReqs [][]Security, components openapi3.Components) (*Operation, error)

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
	Type        string
	Items       *Schema
	Properties  []SchemaProperty
	AllOf       []Schema
	Description string

	Schema *openapi3.Schema
}

func NewSchema

func NewSchema(schema *openapi3.SchemaRef) Schema

type SchemaProperty added in v0.0.11

type SchemaProperty struct {
	Name string
	Schema
}

type Security added in v0.0.12

type Security struct {
	Requirement []string
	Scheme      openapi3.SecurityScheme
}

type Spec

type Spec struct {
	Swagger *openapi3.Swagger

	OpenAPI string
	Info    Info

	Paths      []*PathItem
	Operations []*Operation

	Components Components
}

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