load

package
v1.10.16 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Overview

Package load loads OpenAPI specs from different sources like URLs, paths, globs and stdin Optionally, specs can be preprocessed after loading

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Loader added in v0.0.8

type Loader interface {
	LoadFromURI(*url.URL) (*openapi3.T, error)
	LoadFromFile(string) (*openapi3.T, error)
	LoadFromStdin() (*openapi3.T, error)
}

Loader interface includes the OAS load functions

type Option added in v1.10.6

type Option func(Loader, []*SpecInfo) ([]*SpecInfo, error)

option functions can be used to preprocess specs after loading them

func GetOption added in v1.10.6

func GetOption(option Option, enable bool) Option

GetOption returns the requested option or the identity option

func WithFlattenAllOf added in v1.10.6

func WithFlattenAllOf() Option

WithFlattenAllOf returns SpecInfos with flattened allOf

func WithFlattenParams added in v1.10.6

func WithFlattenParams() Option

WithFlattenParams returns SpecInfos with Common Parameters combined into operation parameters See here for Common Parameters definition: https://swagger.io/docs/specification/describing-parameters/

func WithIdentity added in v1.10.6

func WithIdentity() Option

WithIdentity returns the original SpecInfos

func WithLowercaseHeaders added in v1.10.8

func WithLowercaseHeaders() Option

WithLowercaseHeaders returns SpecInfos with header names converted to lowercase

type Source added in v1.9.0

type Source struct {
	Path string
	Uri  *url.URL
	Type SourceType
}

func NewSource added in v1.9.1

func NewSource(path string) *Source

func (*Source) IsFile added in v1.10.3

func (source *Source) IsFile() bool

func (*Source) IsStdin added in v1.10.3

func (source *Source) IsStdin() bool

func (*Source) Out added in v1.9.0

func (source *Source) Out() string

func (*Source) String added in v1.10.3

func (source *Source) String() string

type SourceType added in v1.10.3

type SourceType int
const (
	SourceTypeStdin SourceType = iota
	SourceTypeURL
	SourceTypeFile
)

type SpecInfo added in v1.5.17

type SpecInfo struct {
	Url     string
	Spec    *openapi3.T
	Version string
}

SpecInfo contains information about an OpenAPI spec and its metadata

func NewSpecInfo added in v1.10.6

func NewSpecInfo(loader Loader, source *Source, options ...Option) (*SpecInfo, error)

NewSpecInfo creates a SpecInfo from a local file path, a URL, or stdin

func NewSpecInfoFromGlob added in v1.10.6

func NewSpecInfoFromGlob(loader Loader, glob string, options ...Option) ([]*SpecInfo, error)

NewSpecInfoFromGlob creates SpecInfos from local files matching the specified glob parameter

func (*SpecInfo) GetVersion added in v1.9.6

func (specInfo *SpecInfo) GetVersion() string

type SpecInfoPair added in v1.9.6

type SpecInfoPair struct {
	Base     *SpecInfo
	Revision *SpecInfo
}

func NewSpecInfoPair added in v1.9.6

func NewSpecInfoPair(specInfo1, specInfo2 *SpecInfo) *SpecInfoPair

func (*SpecInfoPair) GetBaseVersion added in v1.9.6

func (specInfoPair *SpecInfoPair) GetBaseVersion() string

func (*SpecInfoPair) GetRevisionVersion added in v1.9.6

func (specInfoPair *SpecInfoPair) GetRevisionVersion() string

Jump to

Keyboard shortcuts

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