package routers

import "github.com/getkin/kin-openapi/routers"

Index

Variables

var ErrMethodNotAllowed error = &RouteError{"method not allowed"}

ErrMethodNotAllowed is returned when no method of the matched route matches

var ErrPathNotFound error = &RouteError{"no matching operation was found"}

ErrPathNotFound is returned when no route match is found

Types

type Route

type Route struct {
	Spec      *openapi3.T
	Server    *openapi3.Server
	Path      string
	PathItem  *openapi3.PathItem
	Method    string
	Operation *openapi3.Operation
}

Route describes the operation an http.Request can match

type RouteError

type RouteError struct {
	Reason string
}

RouteError describes Router errors

func (*RouteError) Error

func (e *RouteError) Error() string

type Router

type Router interface {
	FindRoute(req *http.Request) (route *Route, pathParams map[string]string, err error)
}

Router helps link http.Request.s and an OpenAPIv3 spec

Source Files

types.go

Directories

PathSynopsis
routers/gorillamuxPackage gorillamux implements a router.
routers/legacyPackage legacy implements a router.
routers/legacy/pathpatternPackage pathpattern implements path matching.
Version
v0.77.0
Published
Oct 7, 2021
Platform
js/wasm
Imports
2 packages
Last checked
1 minute ago

Tools for package owners.