@@ -311,16 +311,17 @@ var mapTemplate = template.Must(template.New("map-template").Parse(
311311// Go that describe the validations for the given map type.
312312func (b * APIs ) parseMapValidation (t * types.Type , found sets.String , comments []string ) (v1beta1.JSONSchemaProps , string ) {
313313 additionalProps , result := b .typeToJSONSchemaProps (t .Elem , found , comments , false )
314+ additionalProps .Description = ""
314315 props := v1beta1.JSONSchemaProps {
315- Type : "object" ,
316+ Type : "object" ,
317+ Description : parseDescription (comments ),
316318 }
317319 parseOption := b .arguments .CustomArgs .(* Options )
318320 if ! parseOption .SkipMapValidation {
319321 props .AdditionalProperties = & v1beta1.JSONSchemaPropsOrBool {
320322 Allows : true ,
321323 Schema : & additionalProps }
322324 }
323-
324325 buff := & bytes.Buffer {}
325326 if err := mapTemplate .Execute (buff , mapTempateArgs {Result : result , SkipMapValidation : parseOption .SkipMapValidation }); err != nil {
326327 log .Fatalf ("%v" , err )
@@ -359,16 +360,19 @@ type arrayTemplateArgs struct {
359360// Go that describe the validations for the given array type.
360361func (b * APIs ) parseArrayValidation (t * types.Type , found sets.String , comments []string ) (v1beta1.JSONSchemaProps , string ) {
361362 items , result := b .typeToJSONSchemaProps (t .Elem , found , comments , false )
363+ items .Description = ""
362364 props := v1beta1.JSONSchemaProps {
363- Type : "array" ,
364- Items : & v1beta1.JSONSchemaPropsOrArray {Schema : & items },
365+ Type : "array" ,
366+ Items : & v1beta1.JSONSchemaPropsOrArray {Schema : & items },
367+ Description : parseDescription (comments ),
365368 }
366369 // To represent byte arrays in the generated code, the property of the OpenAPI definition
367370 // should have string as its type and byte as its format.
368371 if t .Name .Name == "[]byte" {
369372 props .Type = "string"
370373 props .Format = "byte"
371374 props .Items = nil
375+ props .Description = parseDescription (comments )
372376 }
373377 for _ , l := range comments {
374378 getValidation (l , & props )
@@ -409,7 +413,8 @@ var objectTemplate = template.Must(template.New("object-template").Parse(
409413func (b * APIs ) parseObjectValidation (t * types.Type , found sets.String , comments []string , isRoot bool ) (v1beta1.JSONSchemaProps , string ) {
410414 buff := & bytes.Buffer {}
411415 props := v1beta1.JSONSchemaProps {
412- Type : "object" ,
416+ Type : "object" ,
417+ Description : parseDescription (comments ),
413418 }
414419
415420 if strings .HasPrefix (t .Name .String (), "k8s.io/api" ) {
0 commit comments