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
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -74,6 +74,11 @@ type ErrorHandlerOptsMatchedRoute struct {
74
74
// MultiErrorHandler is called when the OpenAPI filter returns an openapi3.MultiError (https://pkg.go.dev/github.com/getkin/kin-openapi/openapi3#MultiError)
// Skipper is a function that runs before any validation middleware, and determines whether the given request should skip any validation middleware
78
+
//
79
+
// Return `true` if the request should be skipped
80
+
typeSkipperfunc(r*http.Request) bool
81
+
77
82
// Options allows configuring the OapiRequestValidator.
78
83
typeOptionsstruct {
79
84
// Options contains any configuration for the underlying `openapi3filter`
@@ -103,6 +108,9 @@ type Options struct {
103
108
// Prefix allows (optionally) trimming a prefix from the API path.
104
109
// This may be useful if your API is routed to an internal path that is different from the OpenAPI specification.
105
110
Prefixstring
111
+
112
+
// Skipper allows writing a function that runs before any middleware and determines whether the given request should skip any validation middleware
113
+
SkipperSkipper
106
114
}
107
115
108
116
// OapiRequestValidator Creates the middleware to validate that incoming requests match the given OpenAPI 3.x spec, with a default set of configuration.
// NOTE that we need to make sure that the `Servers` aren't set, otherwise the OpenAPI validation middleware will validate that the `Host` header (of incoming requests) are targeting known `Servers` in the OpenAPI spec
0 commit comments