Fix bug in dart api gen: path parameter is not replaced

fondoger 2 years ago committed by kevin
parent cd5263ac75
commit 530dd79e3f

@ -185,7 +185,8 @@ func extractPositionalParamsFromPath(route spec.Route) string {
var params []string var params []string
for _, member := range ds.GetTagMembers(pathTagKey) { for _, member := range ds.GetTagMembers(pathTagKey) {
params = append(params, fmt.Sprintf("%s %s", member.Type.Name(), getPropertyFromMember(member))) dartType := member.Type.Name()
params = append(params, fmt.Sprintf("%s %s", dartType, getPropertyFromMember(member)))
} }
return strings.Join(params, ", ") return strings.Join(params, ", ")
@ -199,7 +200,8 @@ func makeDartRequestUrlPath(route spec.Route) string {
} }
for _, member := range ds.GetTagMembers(pathTagKey) { for _, member := range ds.GetTagMembers(pathTagKey) {
path = strings.ReplaceAll(path, ":"+pathTagKey, "${"+getPropertyFromMember(member)+"}") paramName := member.Tags()[0].Name
path = strings.ReplaceAll(path, ":"+paramName, "${"+getPropertyFromMember(member)+"}")
} }
return `"` + path + `"` return `"` + path + `"`

Loading…
Cancel
Save