Skip to content

Commit

Permalink
feat(openapi3filter): add ExludeRequestQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
zekth committed Dec 8, 2023
1 parent 36afc12 commit 7409c6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions openapi3filter/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ type Options struct {
// Set ExcludeRequestBody so ValidateRequest skips request body validation
ExcludeRequestBody bool

// Set ExcludeRequestQuery so ValidateRequest skips request query params validation
ExcludeRequestQuery bool

// Set ExcludeResponseBody so ValidateResponse skips response body validation
ExcludeResponseBody bool

Expand Down
3 changes: 3 additions & 0 deletions openapi3filter/validate_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ func ValidateRequest(ctx context.Context, input *RequestValidationInput) (err er

// For each parameter of the Operation
for _, parameter := range operationParameters {
if options.ExcludeRequestQuery && parameter.Value.In == openapi3.ParameterInQuery {
continue
}
if err = ValidateParameter(ctx, input, parameter.Value); err != nil && !options.MultiError {
return
}
Expand Down

0 comments on commit 7409c6e

Please sign in to comment.