func explodeURL(reg rdl.TypeRegistry, r *rdl.Resource) string { path := r.Path params := "" delim := "" for _, v := range r.Inputs { k := v.Name gk := goName(string(k)) if v.PathParam { // if v.Type == "String" { path = strings.Replace(path, "{"+string(k)+"}", "\" + "+gk+" + \"", -1) } else { path = strings.Replace(path, "{"+string(k)+"}", "\" + fmt.Sprint("+gk+") + \"", -1) } } else if v.QueryParam != "" { qp := v.QueryParam item := "" if reg.IsArrayTypeName(v.Type) { item = "encodeListParam(\"" + qp + "\"," + gk + ")" } else { baseType := reg.BaseTypeName(v.Type) if v.Optional && baseType != "String" { item = "encodeOptional" + string(baseType) + "Param(\"" + qp + "\", " + gk + ")" } else { def := goLiteral(v.Default, string(baseType)) if baseType == "Enum" { def = "\"" + def + "\"" item = "encodeStringParam(\"" + qp + "\", " + gk + ".String(), " + def + ")" } else { item = "encode" + string(baseType) + "Param(\"" + qp + "\", " + strings.ToLower(string(baseType)) + "(" + gk + "), " + def + ")" } } } params += delim + item delim = ", " } } path = "\"" + path if strings.HasSuffix(path, " + \"") { path = path[0 : len(path)-4] } else { path += "\"" } if params != "" { path = path + " + encodeParams(" + params + ")" } return path }