diff --git a/pkg/crd/testdata/cronjob_types.go b/pkg/crd/testdata/cronjob_types.go index 4569d2f7d..4cf20fe12 100644 --- a/pkg/crd/testdata/cronjob_types.go +++ b/pkg/crd/testdata/cronjob_types.go @@ -374,6 +374,17 @@ type CronJobSpec struct { // This tests that selectable field. SelectableFieldString string `json:"selectableFieldString,omitempty"` + + // This tests that embedded struct, which is an alias type, is handled correctly. + InlineAlias `json:",inline"` +} + +type InlineAlias = EmbeddedStruct + +// EmbeddedStruct is for testing that embedded struct is handled correctly when it is used through an alias type. +type EmbeddedStruct struct { + // FromEmbedded is a field from the embedded struct that was used through an alias type. + FromEmbedded string `json:"fromEmbedded,omitempty"` } type StringAlias = string diff --git a/pkg/crd/testdata/testdata.kubebuilder.io_cronjobs.yaml b/pkg/crd/testdata/testdata.kubebuilder.io_cronjobs.yaml index a3bcc2f89..bca4851ef 100644 --- a/pkg/crd/testdata/testdata.kubebuilder.io_cronjobs.yaml +++ b/pkg/crd/testdata/testdata.kubebuilder.io_cronjobs.yaml @@ -234,6 +234,10 @@ spec: Test that we can add a forbidden field using XValidation Reason and FieldPath. The validation is applied to the spec struct itself and not the field. type: integer + fromEmbedded: + description: FromEmbedded is a field from the embedded struct that + was used through an alias type. + type: string hosts: description: This tests string slice item validation. items: