openapi

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 9 Imported by: 7

Documentation

Overview

Package openapi contains middleware to validate requests against an OpenAPI schema.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validator

func Validator(swagger *openapi3.T) func(next http.Handler) http.Handler

Validator creates middleware to validate request by swagger spec. This middleware is good for net/http either since go-chi is 100% compatible with net/http.

This code is taken from the oapi-codegen package and has been modified to return JSON error responses rather than plaintext ones.

func ValidatorWithOptions

func ValidatorWithOptions(swagger *openapi3.T, options *Options) func(next http.Handler) http.Handler

ValidatorWithOptions Creates middleware to validate request by swagger spec. This middleware is good for net/http either since go-chi is 100% compatible with net/http.

This code is taken from the oapi-codegen package and has been modified to return JSON error responses rather than plaintext ones.

Types

type Options

type Options struct {
	Options openapi3filter.Options
}

Options to customize request validation, openapi3filter specified options will be passed through.

Jump to

Keyboard shortcuts

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