@@ -265,20 +265,27 @@ var objectTemplate = template.Must(template.New("object-template").Parse(
265
265
}` ))
266
266
267
267
func (b * APIs ) parseObjectValidation (t * types.Type , found sets.String , comments []string ) (v1beta1.JSONSchemaProps , string ) {
268
- m , result := b . getMembers ( t , found )
268
+ buff := & bytes. Buffer {}
269
269
props := v1beta1.JSONSchemaProps {
270
- Type : "object" ,
271
- Properties : m ,
270
+ Type : "object" ,
272
271
}
273
272
274
- // Only add field validation for non-inlined fields
275
- for _ , l := range comments {
276
- getValidation (l , & props )
277
- }
273
+ if strings .HasPrefix (t .Name .String (), "k8s.io/api" ) {
274
+ if err := objectTemplate .Execute (buff , objectTemplateArgs {props , nil }); err != nil {
275
+ log .Fatalf ("%v" , err )
276
+ }
277
+ } else {
278
+ m , result := b .getMembers (t , found )
279
+ props .Properties = m
278
280
279
- buff := & bytes.Buffer {}
280
- if err := objectTemplate .Execute (buff , objectTemplateArgs {props , result }); err != nil {
281
- log .Fatalf ("%v" , err )
281
+ // Only add field validation for non-inlined fields
282
+ for _ , l := range comments {
283
+ getValidation (l , & props )
284
+ }
285
+
286
+ if err := objectTemplate .Execute (buff , objectTemplateArgs {props , result }); err != nil {
287
+ log .Fatalf ("%v" , err )
288
+ }
282
289
}
283
290
return props , buff .String ()
284
291
}
0 commit comments