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


##########
generate/generate.go:
##########
@@ -179,6 +179,85 @@ var customResponseStructTypes = map[string]string{
        "findHostsForMigration": "HostForMigration",
 }
 
+// listResponseKeys records the JSON key CloudStack uses for the items of a 
list
+// response, for every API where that key differs from the one derived from the
+// API name.
+//
+// The key cannot be computed. CloudStack keys the item array by the *response
+// object* name (UserVmResponse serialises as "virtualmachine", 
TemplateResponse
+// as "template"), while the fallback below derives it from the API name. When 
an
+// API's response object does not share its name, the two disagree and there is
+// nothing in listApis to reconcile them from: it reports each response's 
fields
+// but never the object name, and `related` is empty for exactly these APIs.
+//
+// Getting this wrong fails silently and is therefore expensive: `count` parses
+// from the same body, so a caller sees a correct count beside an empty slice 
and
+// no error. Do not add a guessed entry; an entry invented from the API name is
+// as harmful as a missing one, because it looks deliberate. Every key here was
+// observed in the response of a real management server, and
+// test/ListResponseJSONTagsRegression_test.go pins them so a regeneration
+// cannot quietly undo one.

Review Comment:
   The comment overstates test coverage: 
`test/ListResponseJSONTagsRegression_test.go` only asserts a subset of 
`listResponseKeys` (the newly swept keys + a few older regressions), so saying 
it “pins them” (all keys) is inaccurate and could mislead future maintainers 
about regression protection.



-- 
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