Documentation ¶
Index ¶
- Constants
- func GetGinContext(c context.Context) *gin.Context
- func GetUserData(c context.Context) interface{}
- func OapiRequestValidator(swagger *openapi3.T) gin.HandlerFunc
- func OapiRequestValidatorWithOptions(swagger *openapi3.T, options *Options) gin.HandlerFunc
- func OapiValidatorFromYamlFile(path string) (gin.HandlerFunc, error)
- func ValidateRequestFromContext(c *gin.Context, router routers.Router, options *Options) error
- type Options
Constants ¶
View Source
const GinContextKey = "oapi-codegen/gin-context"
View Source
const UserDataKey = "oapi-codegen/user-data"
Variables ¶
This section is empty.
Functions ¶
func GetGinContext ¶
Helper function to get the echo context from within requests. It returns nil if not found or wrong type.
func GetUserData ¶
func OapiRequestValidator ¶
func OapiRequestValidator(swagger *openapi3.T) gin.HandlerFunc
This is an gin middleware function which validates incoming HTTP requests to make sure that they conform to the given OAPI 3.0 specification. When OAPI validation fails on the request, we return an HTTP/400 with error message
func OapiRequestValidatorWithOptions ¶
func OapiRequestValidatorWithOptions(swagger *openapi3.T, options *Options) gin.HandlerFunc
Create a validator from a swagger object, with validation options
func OapiValidatorFromYamlFile ¶
func OapiValidatorFromYamlFile(path string) (gin.HandlerFunc, error)
Create validator middleware from a YAML file path
Types ¶
type Options ¶
type Options struct { Options openapi3filter.Options ParamDecoder openapi3filter.ContentParameterDecoder UserData interface{} }
Options to customize request validation. These are passed through to openapi3filter.
Click to show internal directories.
Click to hide internal directories.