Skip to content

Commit 676d989

Browse files
committed
code-generator/examples: fix json tags
Signed-off-by: Dr. Stefan Schimanski <[email protected]>
1 parent be2cf7e commit 676d989

File tree

13 files changed

+39
-25
lines changed

13 files changed

+39
-25
lines changed

staging/src/k8s.io/code-generator/examples/HyphenGroup/apis/example/v1/types.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ type TestTypeList struct {
4343
}
4444

4545
type TestTypeStatus struct {
46-
Blah string
46+
Blah string `json:"blah"`
4747
}
4848

4949
// +genclient:nonNamespaced
5050
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
5151

5252
type ClusterTestTypeList struct {
53-
metav1.TypeMeta
54-
metav1.ListMeta
55-
Items []ClusterTestType
53+
metav1.TypeMeta `json:",inline"`
54+
metav1.ListMeta `json:"metadata,omitempty"`
55+
Items []ClusterTestType `json:"items"`
5656
}
5757

5858
// +genclient
@@ -70,5 +70,5 @@ type ClusterTestType struct {
7070
}
7171

7272
type ClusterTestTypeStatus struct {
73-
Blah string
73+
Blah string `json:"blah"`
7474
}

staging/src/k8s.io/code-generator/examples/MixedCase/apis/example/v1/types.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,17 @@ type TestTypeList struct {
4343
}
4444

4545
type TestTypeStatus struct {
46-
Blah string
46+
Blah string `json:"blah"`
4747
}
4848

4949
// +genclient:nonNamespaced
5050
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
5151

5252
type ClusterTestTypeList struct {
53-
metav1.TypeMeta
54-
metav1.ListMeta
55-
Items []ClusterTestType
53+
metav1.TypeMeta `json:",inline"`
54+
// +optional
55+
metav1.ListMeta `json:"metadata,omitempty"`
56+
Items []ClusterTestType `json:"items"`
5657
}
5758

5859
// +genclient
@@ -71,5 +72,5 @@ type ClusterTestType struct {
7172
}
7273

7374
type ClusterTestTypeStatus struct {
74-
Blah string
75+
Blah string `json:"blah"`
7576
}

staging/src/k8s.io/code-generator/examples/apiserver/apis/core/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2424
// TestType is a top-level type. A client is created for it.
2525
type TestType struct {
2626
metav1.TypeMeta
27+
// +optional
2728
metav1.ObjectMeta
29+
// +optional
2830
Status TestTypeStatus
2931
}
3032

@@ -34,6 +36,7 @@ type TestType struct {
3436
// You are not supposed to create a separated client for this one.
3537
type TestTypeList struct {
3638
metav1.TypeMeta
39+
// +optional
3740
metav1.ListMeta
3841

3942
Items []TestType

staging/src/k8s.io/code-generator/examples/apiserver/apis/core/v1/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ type TestTypeList struct {
4343
}
4444

4545
type TestTypeStatus struct {
46-
Blah string
46+
Blah string `json:"blah"`
4747
}

staging/src/k8s.io/code-generator/examples/apiserver/apis/example/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2424
// TestType is a top-level type. A client is created for it.
2525
type TestType struct {
2626
metav1.TypeMeta
27+
// +optional
2728
metav1.ObjectMeta
29+
// +optional
2830
Status TestTypeStatus
2931
}
3032

@@ -34,6 +36,7 @@ type TestType struct {
3436
// You are not supposed to create a separated client for this one.
3537
type TestTypeList struct {
3638
metav1.TypeMeta
39+
// +optional
3740
metav1.ListMeta
3841

3942
Items []TestType

staging/src/k8s.io/code-generator/examples/apiserver/apis/example/v1/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ type TestTypeList struct {
4343
}
4444

4545
type TestTypeStatus struct {
46-
Blah string
46+
Blah string `json:"blah"`
4747
}

staging/src/k8s.io/code-generator/examples/apiserver/apis/example2/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
// +genclient
2222
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
2323
// +genclient:nonNamespaced
24+
//
2425
// TestType is a top-level type. A client is created for it.
2526
type TestType struct {
2627
metav1.TypeMeta

staging/src/k8s.io/code-generator/examples/apiserver/apis/example2/v1/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ type TestTypeList struct {
4343
}
4444

4545
type TestTypeStatus struct {
46-
Blah string
46+
Blah string `json:"blah"`
4747
}

staging/src/k8s.io/code-generator/examples/apiserver/apis/example3.io/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2424
// TestType is a top-level type. A client is created for it.
2525
type TestType struct {
2626
metav1.TypeMeta
27+
// +optional
2728
metav1.ObjectMeta
29+
// +optional
2830
Status TestTypeStatus
2931
}
3032

@@ -34,6 +36,7 @@ type TestType struct {
3436
// You are not supposed to create a separated client for this one.
3537
type TestTypeList struct {
3638
metav1.TypeMeta
39+
// +optional
3740
metav1.ListMeta
3841

3942
Items []TestType

staging/src/k8s.io/code-generator/examples/apiserver/apis/example3.io/v1/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ type TestTypeList struct {
4343
}
4444

4545
type TestTypeStatus struct {
46-
Blah string
46+
Blah string `json:"blah"`
4747
}

0 commit comments

Comments
 (0)