Skip to content

Commit

Permalink
Add array types to crd test data
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Kralicky <[email protected]>
  • Loading branch information
kralicky committed Feb 12, 2022
1 parent aa7ab67 commit 3102f89
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/crd/testdata/cronjob_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ type CronJobSpec struct {
// +kubebuilder:validation:XValidation:rule="self.size() % 2 == 0",message="must have even length"
// +kubebuilder:validation:XValidation:rule="true"
StringWithEvenLength string `json:"stringWithEvenLength,omitempty"`

// Checks that fixed-length arrays work
Array [3]int `json:"array,omitempty"`

// Checks that arrays work when the type contains a composite literal
ArrayUsingCompositeLiteral [len(struct{ X [3]int }{}.X)]string `json:"arrayUsingCompositeLiteral,omitempty"`
}

type ContainsNestedMap struct {
Expand Down
11 changes: 11 additions & 0 deletions pkg/crd/testdata/testdata.kubebuilder.io_cronjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ spec:
spec:
description: CronJobSpec defines the desired state of CronJob
properties:
array:
description: Checks that fixed-length arrays work
items:
type: integer
type: array
arrayUsingCompositeLiteral:
description: Checks that arrays work when the type contains a composite
literal
items:
type: string
type: array
associativeList:
description: This tests that associative lists work.
items:
Expand Down

0 comments on commit 3102f89

Please sign in to comment.