Skip to content

Commit

Permalink
Use new complex nullable types from norman
Browse files Browse the repository at this point in the history
Opt into new field types in norman that will convert arrays and maps to
pointers in the generated client code. The generated client code
includes "omitempty" JSON tags, which means that unset and empty values
are both sent to the server as unset, which breaks the cluster create
validation. With this change, there's now a difference between a nil
value and an empty allocated object in the client code.
  • Loading branch information
cmurphy committed May 19, 2021
1 parent 41aa259 commit ec753c5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/apis/gke.cattle.io/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type GKEClusterConfigSpec struct {
Zone string `json:"zone" norman:"noupdate"`
Imported bool `json:"imported" norman:"noupdate"`
Description string `json:"description"`
Labels map[string]string `json:"labels"`
Labels map[string]string `json:"labels" norman:"type=nullablemap[string]"`
EnableKubernetesAlpha *bool `json:"enableKubernetesAlpha"`
ClusterAddons *GKEClusterAddons `json:"clusterAddons"`
ClusterIpv4CidrBlock *string `json:"clusterIpv4Cidr" norman:"type=nullablestring"`
Expand All @@ -54,7 +54,7 @@ type GKEClusterConfigSpec struct {
PrivateClusterConfig *GKEPrivateClusterConfig `json:"privateClusterConfig,omitempty"`
IPAllocationPolicy *GKEIPAllocationPolicy `json:"ipAllocationPolicy,omitempty"`
MasterAuthorizedNetworksConfig *GKEMasterAuthorizedNetworksConfig `json:"masterAuthorizedNetworks,omitempty"`
Locations []string `json:"locations"`
Locations []string `json:"locations" norman:"type=nullablearray[string]"`
MaintenanceWindow *string `json:"maintenanceWindow,omitempty" norman:"type=nullablestring"`
}

Expand Down

0 comments on commit ec753c5

Please sign in to comment.