Skip to content

Commit f01cb1f

Browse files
DanDagaditajinuthankachan
authored andcommitted
fix: rename PathParam to Param for echo/v5
1 parent fea1c8f commit f01cb1f

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

configuration-schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
"type": "boolean",
3030
"description": "EchoServer specifies whether to generate echo server boilerplate"
3131
},
32+
"echo5-server": {
33+
"type": "boolean",
34+
"description": "Echo5Server specifies whether to generate echo v5 server boilerplate"
35+
},
3236
"gin-server": {
3337
"type": "boolean",
3438
"description": "GinServer specifies whether to generate gin server boilerplate"

pkg/codegen/templates/echo/v5/echo-wrappers.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ func (w *ServerInterfaceWrapper) {{.OperationId}} (ctx *echo.Context) error {
99
{{range .PathParams}}// ------------- Path parameter "{{.ParamName}}" -------------
1010
var {{$varName := .GoVariableName}}{{$varName}} {{.TypeDef}}
1111
{{if .IsPassThrough}}
12-
{{$varName}} = ctx.PathParam("{{.ParamName}}")
12+
{{$varName}} = ctx.Param("{{.ParamName}}")
1313
{{end}}
1414
{{if .IsJson}}
15-
err = json.Unmarshal([]byte(ctx.PathParam("{{.ParamName}}")), &{{$varName}})
15+
err = json.Unmarshal([]byte(ctx.Param("{{.ParamName}}")), &{{$varName}})
1616
if err != nil {
1717
return echo.NewHTTPError(http.StatusBadRequest, "Error unmarshaling parameter '{{.ParamName}}' as JSON")
1818
}
1919
{{end}}
2020
{{if .IsStyled}}
21-
err = runtime.BindStyledParameterWithOptions("{{.Style}}", "{{.ParamName}}", ctx.PathParam("{{.ParamName}}"), &{{$varName}}, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: {{.Explode}}, Required: {{.Required}}})
21+
err = runtime.BindStyledParameterWithOptions("{{.Style}}", "{{.ParamName}}", ctx.Param("{{.ParamName}}"), &{{$varName}}, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: {{.Explode}}, Required: {{.Required}}})
2222
if err != nil {
2323
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter {{.ParamName}}: %s", err))
2424
}

0 commit comments

Comments
 (0)