Skip to content

Commit

Permalink
Added listAttribute extension
Browse files Browse the repository at this point in the history
  • Loading branch information
seans3 committed Apr 10, 2018
1 parent cd03089 commit 2b51f90
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/generators/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ var tempPatchTags = [...]string{
var tagToExtension = map[string]string{
"patchMergeKey": "x-kubernetes-patch-merge-key",
"patchStrategy": "x-kubernetes-patch-strategy",
"listAttribute": "x-kubernetes-list-attribute",
}

func getOpenAPITagValue(comments []string) []string {
Expand Down
17 changes: 16 additions & 1 deletion pkg/generators/openapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ type Blah struct {
// +patchStrategy=ps
// +patchMergeKey=pmk
WithStructTagExtension string `+"`"+`patchStrategy:"ps" patchMergeKey:"pmk"`+"`"+`
// a member with a list attribute
// +listAttribute=la
WithListAttribute string
}
`)
if err != nil {
Expand Down Expand Up @@ -255,8 +258,20 @@ Type: []string{"string"},
Format: "",
},
},
"WithListAttribute": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-attribute": "la",
},
},
SchemaProps: spec.SchemaProps{
Description: "a member with a list attribute",
Type: []string{"string"},
Format: "",
},
},
},
Required: []string{"String","Int64","Int32","Int16","Int8","Uint","Uint64","Uint32","Uint16","Uint8","Byte","Bool","Float64","Float32","ByteArray","WithExtension","WithStructTagExtension"},
Required: []string{"String","Int64","Int32","Int16","Int8","Uint","Uint64","Uint32","Uint16","Uint8","Byte","Bool","Float64","Float32","ByteArray","WithExtension","WithStructTagExtension","WithListAttribute"},
},
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
Expand Down

0 comments on commit 2b51f90

Please sign in to comment.