services

package
v0.0.0-...-bf9f964 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotMatchingParser = errors.New("spec type does not match parser")
	ErrUnknownParserType = errors.New("unknown parser type")
	DefaultRegistry      = make(ParserRegistry)
)

Functions

func RegisterAt

func RegisterAt[TSpec any, TParser ports.SpecParser](registry *ParserRegistry, provider func(spec TSpec) (TParser, error))

Types

type OpenAPISpecParser

type OpenAPISpecParser struct {
	Spec          libopenapi.Document
	MockGenerator *renderer.MockGenerator
}

func NewOpenAPISpecParser

func NewOpenAPISpecParser(spec *config.OpenApiSpec) (*OpenAPISpecParser, error)

func (OpenAPISpecParser) Handler

func (o OpenAPISpecParser) Handler(ctx context.Context) (http.Handler, error)

type ParserRegistry

type ParserRegistry map[reflect.Type]func(spec any) (ports.SpecParser, error)

func (*ParserRegistry) ParserFor

func (r *ParserRegistry) ParserFor(spec any) (ports.SpecParser, error)

type PlainRuleSpecParser

type PlainRuleSpecParser struct {
	Handlers []ports.RequestHandler
}

func NewPlainRuleSpecParser

func NewPlainRuleSpecParser(spec *config.PlainRuleSpec) (*PlainRuleSpecParser, error)

func (PlainRuleSpecParser) Handler

Jump to

Keyboard shortcuts

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