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
Copy file name to clipboardExpand all lines: oapi_validate.go
+54-9Lines changed: 54 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -46,6 +46,7 @@ type ErrorHandlerOptsMatchedRoute struct {
46
46
// ErrorHandlerOpts contains additional options that are passed to the `ErrorHandlerWithOpts` function in the case of a validation error being returned by the middleware
47
47
typeErrorHandlerOptsstruct {
48
48
// TODO
49
+
// NOTE that this will be nil if there is no matched route (i.e. it's a **??**)
49
50
MatchedRoute*ErrorHandlerOptsMatchedRoute
50
51
51
52
// Error is the underlying error that triggered this error handler to be executed.
@@ -77,6 +78,7 @@ type Options struct {
77
78
// MultiErrorHandler is called when there is an openapi3.MultiError (https://pkg.go.dev/github.com/getkin/kin-openapi/openapi3#MultiError) returned by the `openapi3filter`.
78
79
//
79
80
// If not provided `defaultMultiErrorHandler` will be used.
81
+
// NOTE nto called if ErrorHandlerWithOpts
80
82
MultiErrorHandlerMultiErrorHandler
81
83
// SilenceServersWarning allows silencing a warning for https://github.com/deepmap/oapi-codegen/issues/882 that reports when an OpenAPI spec has `spec.Servers != nil`
82
84
SilenceServersWarningbool
@@ -171,16 +173,27 @@ func performRequestValidationForErrorHandlerWithOpts(next http.Handler, w http.R
// Received an HTTP 400 response. Expected HTTP 400
804
817
// Response body: A bad request was made - but I'm not going to tell you where or how
805
818
//
806
-
// # A request that is malformed is rejected with HTTP 400 Bad Request (with an invalid request body), and is then logged by the ErrorHandlerWithOpts
819
+
// # A request that is malformed is rejected with HTTP 400 Bad Request (with an invalid request body, with multiple issues), and is then logged by the ErrorHandlerWithOpts
807
820
// ErrorHandlerWithOpts: A RequestError was returned when attempting to validate the request to POST /resource: request body has an error: doesn't match schema: Error at "/id": minimum string length is 100
0 commit comments