openapi

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsOpenAPISpec

func IsOpenAPISpec(pathOrURL string) bool

IsOpenAPISpec checks whether a given file path or URL content resembles an OpenAPI specification (v3 or v2/swagger).

func ScalarHandler

func ScalarHandler(docs []*openapi3.T, specPathPrefix string, serverURL string) http.Handler

ScalarHandler returns an http.Handler that serves a Swagger UI page using CDN-hosted Scalar UI.

Types

type Document

type Document struct {
	Doc *openapi3.T
}

func LoadSchema

func LoadSchema(ctx context.Context, pathOrURL string) (*Document, error)

type RouteMatch

type RouteMatch struct {
	Route       *routers.Route
	PathParams  map[string]string
	OperationID string
	Canonical   string
}

type Router

type Router struct {
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(doc *openapi3.T) (*Router, error)

func (*Router) Match

func (r *Router) Match(req *http.Request) (*RouteMatch, error)

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

func NewValidator

func NewValidator() *Validator

func (*Validator) ValidateRequest

func (v *Validator) ValidateRequest(req *http.Request, routeMatch *RouteMatch) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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