@@ -125,15 +125,9 @@ func (b *SchemaBuilder) WithScope(rm meta.RESTMapper) *SchemaBuilder {
125
125
}
126
126
127
127
if namespaced {
128
- if schema .VendorExtensible .Extensions == nil {
129
- schema .VendorExtensible .Extensions = map [string ]any {}
130
- }
131
- schema .VendorExtensible .Extensions [common .ScopeExtensionKey ] = apiextensionsv1 .NamespaceScoped
128
+ schema .VendorExtensible .AddExtension (common .ScopeExtensionKey , apiextensionsv1 .NamespaceScoped )
132
129
} else {
133
- if schema .VendorExtensible .Extensions == nil {
134
- schema .VendorExtensible .Extensions = map [string ]any {}
135
- }
136
- schema .VendorExtensible .Extensions [common .ScopeExtensionKey ] = apiextensionsv1 .ClusterScoped
130
+ schema .VendorExtensible .AddExtension (common .ScopeExtensionKey , apiextensionsv1 .ClusterScoped )
137
131
}
138
132
}
139
133
return b
@@ -161,10 +155,7 @@ func (b *SchemaBuilder) WithCRDCategories(crd *apiextensionsv1.CustomResourceDef
161
155
b .log .Debug ().Str ("resource" , resourceKey ).Msg ("no categories provided for CRD kind" )
162
156
continue
163
157
}
164
- if resourceSchema .VendorExtensible .Extensions == nil {
165
- resourceSchema .VendorExtensible .Extensions = map [string ]any {}
166
- }
167
- resourceSchema .VendorExtensible .Extensions [common .CategoriesExtensionKey ] = crd .Spec .Names .Categories
158
+ resourceSchema .VendorExtensible .AddExtension (common .CategoriesExtensionKey , crd .Spec .Names .Categories )
168
159
b .schemas [resourceKey ] = resourceSchema
169
160
}
170
161
return b
@@ -191,10 +182,7 @@ func (b *SchemaBuilder) WithApiResourceCategories(list []*metav1.APIResourceList
191
182
if ! ok {
192
183
continue
193
184
}
194
- if resourceSchema .VendorExtensible .Extensions == nil {
195
- resourceSchema .VendorExtensible .Extensions = map [string ]any {}
196
- }
197
- resourceSchema .VendorExtensible .Extensions [common .CategoriesExtensionKey ] = apiResource .Categories
185
+ resourceSchema .VendorExtensible .AddExtension (common .CategoriesExtensionKey , apiResource .Categories )
198
186
b .schemas [resourceKey ] = resourceSchema
199
187
}
200
188
}
0 commit comments