Copilot commented on code in PR #164:
URL: https://github.com/apache/cloudstack-go/pull/164#discussion_r3994517197


##########
generate/generate.go:
##########
@@ -1666,6 +1666,10 @@ func (s *service) generateHelperFuncs(a *API) {
                        pn("    p.p = make(map[string]interface{})")
                        pn("")
                        pn("    p.p[\"%s\"] = %s", v, v)
+                       // CloudStack < 4.22 ignores listNetworks' name filter: 
https://github.com/apache/cloudstack-go/issues/140.
+                       if a.Name == "listNetworks" && v == "name" {
+                               pn("    p.p[\"keyword\"] = name")

Review Comment:
   On legacy servers this adds only the substring-based `keyword` filter, but 
the generated helper still returns immediately whenever `l.Count == 1` without 
checking `v.Name == name`. As a result, a lookup such as `prod` can still 
return the sole `production` network instead of reporting no exact match; the 
regression handler models this behavior with `strings.Contains`. Validate the 
returned name even for a single result (and add a single-partial-match case) 
before accepting the fallback.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to