Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.25.0

require (
github.com/getkin/kin-openapi v0.142.0
github.com/labstack/echo/v4 v4.15.4
github.com/labstack/echo/v5 v5.3.0
github.com/stretchr/testify v1.11.1
)

Expand All @@ -13,18 +13,11 @@ require (
github.com/go-openapi/jsonpointer v1.0.0 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/labstack/gommon v0.5.0 // indirect
github.com/mattn/go-colorable v0.1.15 // indirect
github.com/mattn/go-isatty v0.0.23 // indirect
github.com/oasdiff/yaml v0.1.1 // indirect
github.com/oasdiff/yaml3 v0.0.14 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
golang.org/x/crypto v0.54.0 // indirect
golang.org/x/net v0.57.0 // indirect
golang.org/x/sys v0.47.0 // indirect
golang.org/x/text v0.40.0 // indirect
golang.org/x/time v0.15.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
18 changes: 2 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/labstack/echo/v4 v4.15.4 h1:DL45vVYa+BWE+XuW+zZNd9H0YEdZ80UAWJGcTVW4EVs=
github.com/labstack/echo/v4 v4.15.4/go.mod h1:CuMetKIRwsuO/qlAgMq+KTAalwGoB/h4tC+yPdrTj1g=
github.com/labstack/gommon v0.5.0 h1:6VSQ2NOzsnEJ5W6+84E0RbcaDDmgB6NIAzWCczTEe6c=
github.com/labstack/gommon v0.5.0/go.mod h1:Rzlg7HHy1maLfzBYGg9NZcVuz1sA68HHhLjhcEllYE0=
github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY=
github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.23 h1:cYwCQTQf3HB6xUC+BtyCLZNr7IzbOmoZbmssVNzSyiQ=
github.com/mattn/go-isatty v0.0.23/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A=
github.com/labstack/echo/v5 v5.3.0 h1:KT74Mprk053PQEHwSZdeCDIz1BigTZOZhavMD0c9Fjs=
github.com/labstack/echo/v5 v5.3.0/go.mod h1:Q3j2+clBRgJr0O3DDONQeXNsM7RHgSwUhcuo47unqm8=
github.com/oasdiff/yaml v0.1.1 h1:6nHx+pn9gBRM6YpBlFZFQGCCd1nuvqOBtTD3KKTgGxY=
github.com/oasdiff/yaml v0.1.1/go.mod h1:EYJNoyktvWMJ0Hmhx+6qTaqMOsalUaRGT8Sj1hNcegU=
github.com/oasdiff/yaml3 v0.0.14 h1:aLJee3hxBK2H5wdXd9iPcIXb93Nty1Ge0pT171eHtkw=
Expand All @@ -36,16 +30,8 @@ github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 h1:KRzFb2m7YtdldCEkzs6KqmJw4nqEV
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw=
golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk=
golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE=
golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU=
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs=
golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY=
golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U=
Expand Down
4 changes: 2 additions & 2 deletions oapi_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"github.com/getkin/kin-openapi/openapi3filter"
"github.com/getkin/kin-openapi/routers"
"github.com/getkin/kin-openapi/routers/gorillamux"
"github.com/labstack/echo/v4"
echomiddleware "github.com/labstack/echo/v4/middleware"
"github.com/labstack/echo/v5"
echomiddleware "github.com/labstack/echo/v5/middleware"
)

const (
Expand Down Expand Up @@ -109,9 +109,9 @@

skipper := getSkipperFromOptions(options)
return func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {

Check failure on line 112 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

cannot use func(c echo.Context) error {…} (value of type func(c echo.Context) error) as echo.HandlerFunc value in return statement

Check failure on line 112 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

cannot use func(c echo.Context) error {…} (value of type func(c echo.Context) error) as echo.HandlerFunc value in return statement

Check failure on line 112 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

cannot use func(c echo.Context) error {…} (value of type func(c echo.Context) error) as echo.HandlerFunc value in return statement

Check failure on line 112 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

cannot use func(c echo.Context) error {…} (value of type func(c echo.Context) error) as echo.HandlerFunc value in return statement

Check failure on line 112 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

cannot use func(c echo.Context) error {…} (value of type func(c echo.Context) error) as echo.HandlerFunc value in return statement

Check failure on line 112 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

cannot use func(c echo.Context) error {…} (value of type func(c echo.Context) error) as echo.HandlerFunc value in return statement
if skipper(c) {

Check failure on line 113 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to skipper

Check failure on line 113 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to skipper

Check failure on line 113 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to skipper

Check failure on line 113 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to skipper

Check failure on line 113 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to skipper

Check failure on line 113 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to skipper
return next(c)

Check failure on line 114 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to next

Check failure on line 114 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to next

Check failure on line 114 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to next

Check failure on line 114 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to next

Check failure on line 114 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to next

Check failure on line 114 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to next
}

err := ValidateRequestFromContext(c, router, options)
Expand All @@ -121,7 +121,7 @@
}
return err
}
return next(c)

Check failure on line 124 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to next

Check failure on line 124 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to next

Check failure on line 124 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to next

Check failure on line 124 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to next

Check failure on line 124 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to next

Check failure on line 124 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

cannot use c (variable of struct type echo.Context) as *echo.Context value in argument to next
}
}
}
Expand All @@ -143,7 +143,7 @@
// We failed to find a matching route for the request.
if err != nil {
if errors.Is(err, routers.ErrMethodNotAllowed) {
return echo.NewHTTPError(http.StatusMethodNotAllowed)

Check failure on line 146 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

not enough arguments in call to echo.NewHTTPError

Check failure on line 146 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

not enough arguments in call to echo.NewHTTPError

Check failure on line 146 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

not enough arguments in call to echo.NewHTTPError

Check failure on line 146 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

not enough arguments in call to echo.NewHTTPError

Check failure on line 146 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

not enough arguments in call to echo.NewHTTPError

Check failure on line 146 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

not enough arguments in call to echo.NewHTTPError
}

switch e := err.(type) {
Expand Down Expand Up @@ -201,7 +201,7 @@
return &echo.HTTPError{
Code: http.StatusBadRequest,
Message: errorLines[0],
Internal: err,

Check failure on line 204 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

unknown field Internal in struct literal of type echo.HTTPError

Check failure on line 204 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

unknown field Internal in struct literal of type echo.HTTPError

Check failure on line 204 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

unknown field Internal in struct literal of type echo.HTTPError

Check failure on line 204 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

unknown field Internal in struct literal of type echo.HTTPError

Check failure on line 204 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

unknown field Internal in struct literal of type echo.HTTPError

Check failure on line 204 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

unknown field Internal in struct literal of type echo.HTTPError
}
case *openapi3filter.SecurityRequirementsError:
for _, err := range e.Errors {
Expand All @@ -213,7 +213,7 @@
return &echo.HTTPError{
Code: http.StatusForbidden,
Message: e.Error(),
Internal: err,

Check failure on line 216 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

unknown field Internal in struct literal of type echo.HTTPError

Check failure on line 216 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

unknown field Internal in struct literal of type echo.HTTPError

Check failure on line 216 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

unknown field Internal in struct literal of type echo.HTTPError

Check failure on line 216 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

unknown field Internal in struct literal of type echo.HTTPError

Check failure on line 216 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

unknown field Internal in struct literal of type echo.HTTPError

Check failure on line 216 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

unknown field Internal in struct literal of type echo.HTTPError
}
default:
// This should never happen today, but if our upstream code changes,
Expand All @@ -221,7 +221,7 @@
return &echo.HTTPError{
Code: http.StatusInternalServerError,
Message: fmt.Sprintf("error validating request: %s", err),
Internal: err,

Check failure on line 224 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

unknown field Internal in struct literal of type echo.HTTPError

Check failure on line 224 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

unknown field Internal in struct literal of type echo.HTTPError

Check failure on line 224 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

unknown field Internal in struct literal of type echo.HTTPError

Check failure on line 224 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

unknown field Internal in struct literal of type echo.HTTPError

Check failure on line 224 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

unknown field Internal in struct literal of type echo.HTTPError

Check failure on line 224 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

unknown field Internal in struct literal of type echo.HTTPError
}
}
}
Expand All @@ -233,11 +233,11 @@
func GetEchoContext(c context.Context) echo.Context {
iface := c.Value(EchoContextKey)
if iface == nil {
return nil

Check failure on line 236 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

cannot use nil as echo.Context value in return statement

Check failure on line 236 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

cannot use nil as echo.Context value in return statement

Check failure on line 236 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

cannot use nil as echo.Context value in return statement

Check failure on line 236 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

cannot use nil as echo.Context value in return statement

Check failure on line 236 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

cannot use nil as echo.Context value in return statement

Check failure on line 236 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

cannot use nil as echo.Context value in return statement
}
eCtx, ok := iface.(echo.Context)
if !ok {
return nil

Check failure on line 240 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

cannot use nil as echo.Context value in return statement

Check failure on line 240 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.26)

cannot use nil as echo.Context value in return statement

Check failure on line 240 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

cannot use nil as echo.Context value in return statement

Check failure on line 240 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

cannot use nil as echo.Context value in return statement

Check failure on line 240 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Build (1.25)

cannot use nil as echo.Context value in return statement

Check failure on line 240 in oapi_validate.go

View workflow job for this annotation

GitHub Actions / build / Lint (1.26)

cannot use nil as echo.Context value in return statement
}
return eCtx
}
Expand Down
2 changes: 1 addition & 1 deletion oapi_validate_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/getkin/kin-openapi/openapi3"
"github.com/getkin/kin-openapi/openapi3filter"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v5"
middleware "github.com/oapi-codegen/echo-middleware"
)

Expand Down
4 changes: 2 additions & 2 deletions oapi_validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (

"github.com/getkin/kin-openapi/openapi3"
"github.com/getkin/kin-openapi/openapi3filter"
"github.com/labstack/echo/v4"
echomiddleware "github.com/labstack/echo/v4/middleware"
"github.com/labstack/echo/v5"
echomiddleware "github.com/labstack/echo/v5/middleware"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
Loading