-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
The template generates multiple parameters. Example:
var cookie *http.Cookie
if cookie, err = r.Cookie("cookie1"); err == nil {
var value string
err = runtime.BindStyledParameter("simple", true, "oauth2_authentication_csrf", cookie.Value, &value)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "oauth2_authentication_csrf", Err: err})
return
}
params.Oauth2AuthenticationCsrf = &value
}
var cookie *http.Cookie
if cookie, err = r.Cookie("cookie2"); err == nil {
var value string
err = runtime.BindStyledParameter("simple", true, "ulsid", cookie.Value, &value)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "ulsid", Err: err})
return
}
params.Ulsid = &value
}
Note that var cookie *http.Cookie is duplicated and caused compile error.
I checked it's true for both chi and gorilla middleware.
Code reference for Chi: https://github.com/deepmap/oapi-codegen/blob/a444d309616eaac712c1b1a633c0818613918e11/pkg/codegen/templates/chi/chi-middleware.tmpl#L129
Code reference for Gorilla: https://github.com/deepmap/oapi-codegen/blob/ab90f1927bc5ec3e29af216d4298fbb4780ae36d/pkg/codegen/templates/gorilla/gorilla-middleware.tmpl#L129
Metadata
Metadata
Assignees
Labels
No labels