File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,13 @@ func (l ListType) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
114114 if l != "map" && l != "atomic" && l != "set" {
115115 return fmt .Errorf (`ListType must be either "map", "set" or "atomic"` )
116116 }
117+
118+ if l == "set" {
119+ if itemSchema := schema .Items .Schema ; itemSchema != nil {
120+ v := "atomic"
121+ itemSchema .XMapType = & v
122+ }
123+ }
117124 p := string (l )
118125 schema .XListType = & p
119126 return nil
Original file line number Diff line number Diff line change @@ -233,6 +233,11 @@ type CronJobSpec struct {
233233
234234 // Checks that arrays work when the type contains a composite literal
235235 ArrayUsingCompositeLiteral [len (struct { X [3 ]int }{}.X )]string `json:"arrayUsingCompositeLiteral,omitempty"`
236+
237+ // Tests the generation of a set list type
238+ // +listType=set
239+ // +optional
240+ Set []string `json:"set,omitempty"`
236241}
237242
238243type ContainsNestedMap struct {
Original file line number Diff line number Diff line change @@ -3,9 +3,9 @@ apiVersion: apiextensions.k8s.io/v1
33kind: CustomResourceDefinition
44metadata:
55 annotations:
6- controller-gen.kubebuilder.io/version: (devel)
76 api-approved.kubernetes.io: https://github.com/kubernetes-sigs/controller-tools
87 cert-manager.io/inject-ca-from-secret: cert-manager/cert-manager-webhook-ca
8+ controller-gen.kubebuilder.io/version: (devel)
99 creationTimestamp: null
1010 name: cronjobs.testdata.kubebuilder.io
1111spec:
@@ -7330,6 +7330,13 @@ spec:
73307330 type: string
73317331 schemaless:
73327332 description: This tests that the schemaless marker works
7333+ set:
7334+ description: Tests the generation of a set list type
7335+ items:
7336+ type: string
7337+ x-kubernetes-map-type: atomic
7338+ type: array
7339+ x-kubernetes-list-type: set
73337340 startingDeadlineSeconds:
73347341 description: Optional deadline in seconds for starting the job if
73357342 it misses scheduled time for any reason. Missed jobs executions
You can’t perform that action at this time.
0 commit comments