Skip to content

Commit bba261e

Browse files
gmtstephanejamietanna
authored andcommitted
fix warn log condition
1 parent e327850 commit bba261e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

oapi_validate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ type Options struct {
7979

8080
// OapiRequestValidatorWithOptions creates a validator from a swagger object, with validation options
8181
func OapiRequestValidatorWithOptions(swagger *openapi3.T, options *Options) echo.MiddlewareFunc {
82-
if swagger.Servers != nil && (options == nil || options.SilenceServersWarning) {
82+
if swagger.Servers != nil && (options == nil || !options.SilenceServersWarning) {
8383
log.Println("WARN: OapiRequestValidatorWithOptions called with an OpenAPI spec that has `Servers` set. This may lead to an HTTP 400 with `no matching operation was found` when sending a valid request, as the validator performs `Host` header validation. If you're expecting `Host` header validation, you can silence this warning by setting `Options.SilenceServersWarning = true`. See https://github.com/deepmap/oapi-codegen/issues/882 for more information.")
8484
}
8585

0 commit comments

Comments
 (0)