You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// OapiRequestValidator creates a validator from an OpenAPI spec.
49
+
// OapiRequestValidator Creates the middleware to validate that incoming requests match the given OpenAPI 3.x spec, with a default set of configuration.
// MultiErrorHandler is called when oapi returns a MultiError type
57
+
// MultiErrorHandler is called when the OpenAPI filter returns an openapi3.MultiError (https://pkg.go.dev/github.com/getkin/kin-openapi/openapi3#MultiError)
// UserData is any user-specified data to inject into the context.Context, which is then passed in to the validation function.
74
+
//
75
+
// Set on the Context with the key `UserDataKey`.
76
+
UserDataany
77
+
// Skipper an echo Skipper to allow skipping the middleware.
78
+
Skipper echomiddleware.Skipper
79
+
// MultiErrorHandler is called when there is an openapi3.MultiError (https://pkg.go.dev/github.com/getkin/kin-openapi/openapi3#MultiError) returned by the `openapi3filter`.
80
+
//
81
+
// If not provided `defaultMultiErrorHandler` will be used.
68
82
MultiErrorHandlerMultiErrorHandler
69
83
// SilenceServersWarning allows silencing a warning for https://github.com/oapi-codegen/oapi-codegen/issues/882 that reports when an OpenAPI spec has `spec.Servers != nil`
70
84
SilenceServersWarningbool
71
85
}
72
86
73
-
// OapiRequestValidatorWithOptions creates a validator from an OpenAPI spec, with validation options
87
+
// OapiRequestValidatorWithOptions Creates the middleware to validate that incoming requests match the given OpenAPI 3.x spec, allowing explicit configuration.
88
+
//
89
+
// NOTE that this may panic if the OpenAPI spec isn't valid, or if it cannot be used to create the middleware
log.Println("WARN: OapiRequestValidatorWithOptions called with an OpenAPI spec that has `Servers` set. This may lead to an HTTP 400 with `no matching operation was found` when sending a valid request, as the validator performs `Host` header validation. If you're expecting `Host` header validation, you can silence this warning by setting `Options.SilenceServersWarning = true`. See https://github.com/oapi-codegen/oapi-codegen/issues/882 for more information.")
0 commit comments