Skip to content

Commit aa91ae9

Browse files
authored
Merge pull request #57 from jaypipes/add-shape-to-typedef
add doc support to nested field types
2 parents 71f5331 + 5c68e42 commit aa91ae9

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

pkg/generate/generator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ func (g *Generator) GetTypeDefs() ([]*ackmodel.TypeDef, error) {
356356
continue
357357
}
358358
tdefs = append(tdefs, &ackmodel.TypeDef{
359+
Shape: shape,
359360
Names: tdefNames,
360361
Attrs: attrs,
361362
})

pkg/model/type_def.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
package model
1515

1616
import (
17+
awssdkmodel "github.com/aws/aws-sdk-go/private/model/api"
18+
1719
"github.com/aws-controllers-k8s/code-generator/pkg/names"
1820
)
1921

@@ -29,4 +31,5 @@ const (
2931
type TypeDef struct {
3032
Names names.Names
3133
Attrs map[string]*Attr
34+
Shape *awssdkmodel.Shape
3235
}

templates/apis/type_def.go.tpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
{{- define "type_def" -}}
2+
{{- if .Shape.Documentation }}
3+
{{ .Shape.Documentation }}
4+
{{- end }}
25
type {{ .Names.Camel }} struct {
36
{{- range $attrName, $attr := .Attrs }}
7+
{{- if $attr.Shape.Documentation }}
8+
{{ $attr.Shape.Documentation }}
9+
{{- end }}
410
{{ $attr.Names.Camel }} {{ $attr.GoType }} `json:"{{ $attr.Names.CamelLower }},omitempty"`
511
{{- end }}
612
}

0 commit comments

Comments
 (0)