Copilot commented on code in PR #2538: URL: https://github.com/apache/apisix-ingress-controller/pull/2538#discussion_r2315066936
########## api/adc/types.go: ########## @@ -505,6 +505,13 @@ func (n *UpstreamNodes) UnmarshalJSON(p []byte) error { return nil } +func (n UpstreamNodes) MarshalJSON() ([]byte, error) { + if n == nil { + return []byte("[]"), nil + } + return json.Marshal([]UpstreamNode(n)) +} Review Comment: This method lacks documentation explaining its purpose and behavior. Add a comment describing that it handles marshaling of UpstreamNodes to JSON, returning an empty array when the nodes collection is nil. -- 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: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org