@@ -29,7 +29,7 @@ var ErrInvalidEmptyValue = errors.New("empty value is not allowed")
2929//
3030// Note: One can tune the behavior of uniqueItems: true verification
3131// by registering a custom function with openapi3.RegisterArrayUniqueItemsChecker
32- func ValidateRequest (ctx context.Context , input * RequestValidationInput ) ( err error ) {
32+ func ValidateRequest (ctx context.Context , input * RequestValidationInput ) error {
3333 var me openapi3.MultiError
3434
3535 options := input .Options
@@ -49,10 +49,10 @@ func ValidateRequest(ctx context.Context, input *RequestValidationInput) (err er
4949 security = & route .Spec .Security
5050 }
5151 if security != nil {
52- if err = ValidateSecurityRequirements (ctx , input , * security ); err != nil && ! options . MultiError {
53- return
54- }
55- if err != nil {
52+ if err : = ValidateSecurityRequirements (ctx , input , * security ); err != nil {
53+ if ! options . MultiError {
54+ return err
55+ }
5656 me = append (me , err )
5757 }
5858 }
@@ -66,10 +66,10 @@ func ValidateRequest(ctx context.Context, input *RequestValidationInput) (err er
6666 }
6767 }
6868
69- if err = ValidateParameter (ctx , input , parameter ); err != nil && ! options . MultiError {
70- return
71- }
72- if err != nil {
69+ if err : = ValidateParameter (ctx , input , parameter ); err != nil {
70+ if ! options . MultiError {
71+ return err
72+ }
7373 me = append (me , err )
7474 }
7575 }
@@ -79,29 +79,29 @@ func ValidateRequest(ctx context.Context, input *RequestValidationInput) (err er
7979 if options .ExcludeRequestQueryParams && parameter .Value .In == openapi3 .ParameterInQuery {
8080 continue
8181 }
82- if err = ValidateParameter (ctx , input , parameter .Value ); err != nil && ! options . MultiError {
83- return
84- }
85- if err != nil {
82+ if err : = ValidateParameter (ctx , input , parameter .Value ); err != nil {
83+ if ! options . MultiError {
84+ return err
85+ }
8686 me = append (me , err )
8787 }
8888 }
8989
9090 // RequestBody
9191 requestBody := operation .RequestBody
9292 if requestBody != nil && ! options .ExcludeRequestBody {
93- if err = ValidateRequestBody (ctx , input , requestBody .Value ); err != nil && ! options . MultiError {
94- return
95- }
96- if err != nil {
93+ if err : = ValidateRequestBody (ctx , input , requestBody .Value ); err != nil {
94+ if ! options . MultiError {
95+ return err
96+ }
9797 me = append (me , err )
9898 }
9999 }
100100
101101 if len (me ) > 0 {
102102 return me
103103 }
104- return
104+ return nil
105105}
106106
107107// appendToQueryValues adds to query parameters each value in the provided slice
0 commit comments