diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 66b0049474f..89c8f2e4ab5 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -3,6 +3,9 @@ ### SDK Enhancements ### SDK Bugs +* `private/model/api`: Fix API doc being generated with wrong value ([#359](https://github.com/aws/aws-sdk-go-v2/pull/359)) + * Fixes the SDK's generated API documentation for structure member being generated with the wrong documentation value when the member was included multiple times in the model doc-2.json file, but under different types. + * V2 port of to v1 [aws/aws-sdk-go#2748](https://github.com/aws/aws-sdk-go/issues/2748) * `aws/ec2rolecreds`: Fix security creds path to include trailing slash ([#356](https://github.com/aws/aws-sdk-go-v2/pull/356)) * Fixes the iamSecurityCredsPath var to include a trailing slash preventing redirects when making requests to the EC2 Instance Metadata service. * Fixes [#351](https://github.com/aws/aws-sdk-go-v2/issues/351) diff --git a/private/model/api/docstring.go b/private/model/api/docstring.go index a6ccbba480d..e13c4306162 100644 --- a/private/model/api/docstring.go +++ b/private/model/api/docstring.go @@ -17,7 +17,6 @@ import ( ) type apiDocumentation struct { - *API Operations map[string]string Service string Shapes map[string]shapeDocumentation @@ -30,7 +29,7 @@ type shapeDocumentation struct { // AttachDocs attaches documentation from a JSON filename. func (a *API) AttachDocs(filename string) { - d := apiDocumentation{API: a} + var d apiDocumentation f, err := os.Open(filename) defer f.Close() @@ -42,39 +41,40 @@ func (a *API) AttachDocs(filename string) { panic(err) } - d.setup() - + d.setup(a) } -func (d *apiDocumentation) setup() { - d.API.Documentation = docstring(d.Service) +func (d *apiDocumentation) setup(a *API) { + a.Documentation = docstring(d.Service) for opName, doc := range d.Operations { - if _, ok := d.API.Operations[opName]; !ok { + if _, ok := a.Operations[opName]; !ok { panic(fmt.Sprintf("%s, doc op %q not found in API op set", - d.API.ServiceID(), opName), + a.ServiceID(), opName), ) } - d.API.Operations[opName].Documentation = docstring(doc) + a.Operations[opName].Documentation = docstring(doc) } - for shape, info := range d.Shapes { - if sh := d.API.Shapes[shape]; sh != nil { - sh.Documentation = docstring(info.Base) + for shapeName, docShape := range d.Shapes { + if s, ok := a.Shapes[shapeName]; ok { + s.Documentation = docstring(docShape.Base) } - for ref, doc := range info.Refs { + for ref, doc := range docShape.Refs { if doc == "" { continue } parts := strings.Split(ref, "$") if len(parts) != 2 { - fmt.Fprintf(os.Stderr, "Shape Doc %s has unexpected reference format, %q\n", shape, ref) + fmt.Fprintf(os.Stderr, + "Shape Doc %s has unexpected reference format, %q\n", + shapeName, ref) continue } - if sh := d.API.Shapes[parts[0]]; sh != nil { - if m := sh.MemberRefs[parts[1]]; m != nil { + if s, ok := a.Shapes[parts[0]]; ok && len(s.MemberRefs) != 0 { + if m, ok := s.MemberRefs[parts[1]]; ok && m.ShapeName == shapeName { m.Documentation = docstring(doc) } } diff --git a/service/kafka/api_op_CreateCluster.go b/service/kafka/api_op_CreateCluster.go index b61c2f21225..502b1369650 100644 --- a/service/kafka/api_op_CreateCluster.go +++ b/service/kafka/api_op_CreateCluster.go @@ -44,7 +44,7 @@ type CreateClusterInput struct { // KafkaVersion is a required field KafkaVersion *string `locationName:"kafkaVersion" min:"1" type:"string" required:"true"` - // The number of broker nodes in the cluster. + // The number of Kafka broker nodes in the Amazon MSK cluster. // // NumberOfBrokerNodes is a required field NumberOfBrokerNodes *int64 `locationName:"numberOfBrokerNodes" min:"1" type:"integer" required:"true"`