AlinsRan commented on code in PR #2551:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/2551#discussion_r2335856106


##########
api/adc/types.go:
##########
@@ -195,15 +195,14 @@ type Timeout struct {
 
 // +k8s:deepcopy-gen=true
 type StreamRoute struct {
-       Description string            `json:"description,omitempty"`
-       ID          string            `json:"id,omitempty"`
-       Labels      map[string]string `json:"labels,omitempty"`
-       Name        string            `json:"name"`
-       Plugins     Plugins           `json:"plugins,omitempty"`
-       RemoteAddr  string            `json:"remote_addr,omitempty"`
-       ServerAddr  string            `json:"server_addr,omitempty"`
-       ServerPort  *int64            `json:"server_port,omitempty"`
-       Sni         string            `json:"sni,omitempty"`
+       Metadata `json:",inline" yaml:",inline"`
+
+       Labels     map[string]string `json:"labels,omitempty"`
+       Plugins    Plugins           `json:"plugins,omitempty"`
+       RemoteAddr string            `json:"remote_addr,omitempty"`
+       ServerAddr string            `json:"server_addr,omitempty"`
+       ServerPort int32             `json:"server_port,omitempty"`

Review Comment:
   1. Go standard library uses `int` for ports (e.g. 
[`net.TCPAddr.Port`](https://pkg.go.dev/net#TCPAddr), 
[`net.Listen`](https://pkg.go.dev/net#Listen)), not `uint16`. Staying 
consistent avoids unnecessary conversions.  
   2. JSON has no unsigned integers; using `uint16` can cause wrap-around on 
negative inputs instead of an error. Kubernetes API conventions recommend 
[`int32`/`int64`](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#primitive-types),
 which is safer and widely supported.



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

Reply via email to