Skip to content

Commit

Permalink
Adds inline comment for expected types
Browse files Browse the repository at this point in the history
  • Loading branch information
wbreza committed May 19, 2023
1 parent 4a5ecd5 commit 4202a71
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cli/azd/pkg/tools/kubectl/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,17 @@ type ServiceStatus struct {
}

type Port struct {
Port int `json:"port"`
TargetPort interface{} `json:"targetPort"`
Protocol string `json:"protocol"`
Port int `json:"port"`
// The target port can be a valid port number or well known service name like 'redis'
TargetPort any `json:"targetPort"`
Protocol string `json:"protocol"`
}

func (p *Port) UnmarshalJSON(data []byte) error {
var aux struct {
Port int `json:"port"`
TargetPort interface{} `json:"targetPort"`
Protocol string `json:"protocol"`
Port int `json:"port"`
TargetPort any `json:"targetPort"`
Protocol string `json:"protocol"`
}

if err := json.Unmarshal(data, &aux); err != nil {
Expand Down

0 comments on commit 4202a71

Please sign in to comment.