diff --git a/examples/petstore-expanded/chi/api/petstore.gen.go b/examples/petstore-expanded/chi/api/petstore.gen.go index a1e4f4d6b..bf52a20f3 100644 --- a/examples/petstore-expanded/chi/api/petstore.gen.go +++ b/examples/petstore-expanded/chi/api/petstore.gen.go @@ -154,7 +154,7 @@ func (siw *ServerInterfaceWrapper) DeletePet(w http.ResponseWriter, r *http.Requ // ------------- Path parameter "id" ------------- var id int64 - err = runtime.BindStyledParameter("simple", false, "id", chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return @@ -180,7 +180,7 @@ func (siw *ServerInterfaceWrapper) FindPetByID(w http.ResponseWriter, r *http.Re // ------------- Path parameter "id" ------------- var id int64 - err = runtime.BindStyledParameter("simple", false, "id", chi.URLParam(r, "id"), &id) + err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, chi.URLParam(r, "id"), &id) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return diff --git a/internal/test/server/server.gen.go b/internal/test/server/server.gen.go index cb6a7a0c3..ee11ddd40 100644 --- a/internal/test/server/server.gen.go +++ b/internal/test/server/server.gen.go @@ -276,7 +276,7 @@ func (siw *ServerInterfaceWrapper) GetWithReferences(w http.ResponseWriter, r *h // ------------- Path parameter "global_argument" ------------- var globalArgument int64 - err = runtime.BindStyledParameter("simple", false, "global_argument", chi.URLParam(r, "global_argument"), &globalArgument) + err = runtime.BindStyledParameterWithLocation("simple", false, "global_argument", runtime.ParamLocationPath, chi.URLParam(r, "global_argument"), &globalArgument) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "global_argument", Err: err}) return @@ -285,7 +285,7 @@ func (siw *ServerInterfaceWrapper) GetWithReferences(w http.ResponseWriter, r *h // ------------- Path parameter "argument" ------------- var argument Argument - err = runtime.BindStyledParameter("simple", false, "argument", chi.URLParam(r, "argument"), &argument) + err = runtime.BindStyledParameterWithLocation("simple", false, "argument", runtime.ParamLocationPath, chi.URLParam(r, "argument"), &argument) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "argument", Err: err}) return @@ -311,7 +311,7 @@ func (siw *ServerInterfaceWrapper) GetWithContentType(w http.ResponseWriter, r * // ------------- Path parameter "content_type" ------------- var contentType GetWithContentTypeParamsContentType - err = runtime.BindStyledParameter("simple", false, "content_type", chi.URLParam(r, "content_type"), &contentType) + err = runtime.BindStyledParameterWithLocation("simple", false, "content_type", runtime.ParamLocationPath, chi.URLParam(r, "content_type"), &contentType) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "content_type", Err: err}) return @@ -352,7 +352,7 @@ func (siw *ServerInterfaceWrapper) CreateResource(w http.ResponseWriter, r *http // ------------- Path parameter "argument" ------------- var argument Argument - err = runtime.BindStyledParameter("simple", false, "argument", chi.URLParam(r, "argument"), &argument) + err = runtime.BindStyledParameterWithLocation("simple", false, "argument", runtime.ParamLocationPath, chi.URLParam(r, "argument"), &argument) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "argument", Err: err}) return @@ -378,7 +378,7 @@ func (siw *ServerInterfaceWrapper) CreateResource2(w http.ResponseWriter, r *htt // ------------- Path parameter "inline_argument" ------------- var inlineArgument int - err = runtime.BindStyledParameter("simple", false, "inline_argument", chi.URLParam(r, "inline_argument"), &inlineArgument) + err = runtime.BindStyledParameterWithLocation("simple", false, "inline_argument", runtime.ParamLocationPath, chi.URLParam(r, "inline_argument"), &inlineArgument) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "inline_argument", Err: err}) return @@ -418,7 +418,7 @@ func (siw *ServerInterfaceWrapper) UpdateResource3(w http.ResponseWriter, r *htt // ------------- Path parameter "fallthrough" ------------- var pFallthrough int - err = runtime.BindStyledParameter("simple", false, "fallthrough", chi.URLParam(r, "fallthrough"), &pFallthrough) + err = runtime.BindStyledParameterWithLocation("simple", false, "fallthrough", runtime.ParamLocationPath, chi.URLParam(r, "fallthrough"), &pFallthrough) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "fallthrough", Err: err}) return diff --git a/pkg/codegen/templates/chi/chi-middleware.tmpl b/pkg/codegen/templates/chi/chi-middleware.tmpl index 53a44d39f..7c1385ba2 100644 --- a/pkg/codegen/templates/chi/chi-middleware.tmpl +++ b/pkg/codegen/templates/chi/chi-middleware.tmpl @@ -30,7 +30,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ } {{end}} {{if .IsStyled}} - err = runtime.BindStyledParameter("{{.Style}}",{{.Explode}}, "{{.ParamName}}", chi.URLParam(r, "{{.ParamName}}"), &{{$varName}}) + err = runtime.BindStyledParameterWithLocation("{{.Style}}",{{.Explode}}, "{{.ParamName}}", runtime.ParamLocationPath, chi.URLParam(r, "{{.ParamName}}"), &{{$varName}}) if err != nil { siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err}) return