chore: upgrade dependencies#10091
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates several dependencies in go.mod and go.sum, refactors the go-openapi/runtime middleware for better error handling and TLS diagnostics, and improves the BindForm logic for multipart requests. My feedback highlights a potential issue in validation.go where the error collection logic might be filtering out non-validation errors; I have suggested a more robust way to aggregate these errors.
| result := v.route.Binder.bind(v.request, v.route.Params, v.route.Consumer, v.bound) | ||
| if result == nil { | ||
| return | ||
| } | ||
|
|
||
| for _, e := range result.Errors { | ||
| var validationErr *errors.Validation | ||
| if stderrors.As(e, &validationErr) { | ||
| v.result = append(v.result, validationErr) | ||
| } | ||
| v.result = append(v.result, result) | ||
| } | ||
| } |
There was a problem hiding this comment.
The current implementation for collecting binding errors appears to drop some error types. The loop only appends errors that can be asserted as *errors.Validation, but the binder can also return other error types like *errors.ParseError. This could lead to some validation errors being silently ignored.
To ensure all errors from the binder are collected, you could append the entire slice of errors from the composite error.
| result := v.route.Binder.bind(v.request, v.route.Params, v.route.Consumer, v.bound) | |
| if result == nil { | |
| return | |
| } | |
| for _, e := range result.Errors { | |
| var validationErr *errors.Validation | |
| if stderrors.As(e, &validationErr) { | |
| v.result = append(v.result, validationErr) | |
| } | |
| v.result = append(v.result, result) | |
| } | |
| } | |
| result := v.route.Binder.bind(v.request, v.route.Params, v.route.Consumer, v.bound) | |
| if result == nil { | |
| return | |
| } | |
| v.result = append(v.result, result.Errors...) |
Upgrades dependencies after Go upgrade.