Skip to content

Commit 3102f89

Browse files
committed
Add array types to crd test data
Signed-off-by: Joe Kralicky <[email protected]>
1 parent aa7ab67 commit 3102f89

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

pkg/crd/testdata/cronjob_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ type CronJobSpec struct {
193193
// +kubebuilder:validation:XValidation:rule="self.size() % 2 == 0",message="must have even length"
194194
// +kubebuilder:validation:XValidation:rule="true"
195195
StringWithEvenLength string `json:"stringWithEvenLength,omitempty"`
196+
197+
// Checks that fixed-length arrays work
198+
Array [3]int `json:"array,omitempty"`
199+
200+
// Checks that arrays work when the type contains a composite literal
201+
ArrayUsingCompositeLiteral [len(struct{ X [3]int }{}.X)]string `json:"arrayUsingCompositeLiteral,omitempty"`
196202
}
197203

198204
type ContainsNestedMap struct {

pkg/crd/testdata/testdata.kubebuilder.io_cronjobs.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ spec:
3535
spec:
3636
description: CronJobSpec defines the desired state of CronJob
3737
properties:
38+
array:
39+
description: Checks that fixed-length arrays work
40+
items:
41+
type: integer
42+
type: array
43+
arrayUsingCompositeLiteral:
44+
description: Checks that arrays work when the type contains a composite
45+
literal
46+
items:
47+
type: string
48+
type: array
3849
associativeList:
3950
description: This tests that associative lists work.
4051
items:

0 commit comments

Comments
 (0)