Skip to content

Commit

Permalink
private/model/api: Fix RESTXML support for XML Namespace (#1343)
Browse files Browse the repository at this point in the history
Fixes a bug with the SDK's generation of services using the REST XML
protocol not annotating shape references with the XML Namespace
attribute.

The XML Namespace URI was incorrectly being limited to the top level
API shape, where it should of applied to all levels.

Fix #1334
  • Loading branch information
jasdel committed Jun 14, 2017
1 parent dadbbca commit 63041ae
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 46 deletions.
22 changes: 12 additions & 10 deletions private/model/api/shape.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,16 +400,18 @@ func (ref *ShapeRef) GoTags(toplevel bool, isRequired bool) string {
if ref.Shape.Payload != "" {
tags = append(tags, ShapeTag{"payload", ref.Shape.Payload})
}
if ref.XMLNamespace.Prefix != "" {
tags = append(tags, ShapeTag{"xmlPrefix", ref.XMLNamespace.Prefix})
} else if ref.Shape.XMLNamespace.Prefix != "" {
tags = append(tags, ShapeTag{"xmlPrefix", ref.Shape.XMLNamespace.Prefix})
}
if ref.XMLNamespace.URI != "" {
tags = append(tags, ShapeTag{"xmlURI", ref.XMLNamespace.URI})
} else if ref.Shape.XMLNamespace.URI != "" {
tags = append(tags, ShapeTag{"xmlURI", ref.Shape.XMLNamespace.URI})
}
}

if ref.XMLNamespace.Prefix != "" {
tags = append(tags, ShapeTag{"xmlPrefix", ref.XMLNamespace.Prefix})
} else if ref.Shape.XMLNamespace.Prefix != "" {
tags = append(tags, ShapeTag{"xmlPrefix", ref.Shape.XMLNamespace.Prefix})
}

if ref.XMLNamespace.URI != "" {
tags = append(tags, ShapeTag{"xmlURI", ref.XMLNamespace.URI})
} else if ref.Shape.XMLNamespace.URI != "" {
tags = append(tags, ShapeTag{"xmlURI", ref.Shape.XMLNamespace.URI})
}

if ref.IdempotencyToken || ref.Shape.IdempotencyToken {
Expand Down
2 changes: 1 addition & 1 deletion private/protocol/restxml/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3586,7 +3586,7 @@ func (c *InputService19ProtocolTest) InputService19TestCaseOperation1WithContext
type InputService19TestShapeGrant struct {
_ struct{} `locationName:"Grant" type:"structure"`

Grantee *InputService19TestShapeGrantee `type:"structure"`
Grantee *InputService19TestShapeGrantee `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"`
}

// SetGrantee sets the Grantee field's value.
Expand Down
22 changes: 11 additions & 11 deletions service/cloudfront/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 24 additions & 24 deletions service/s3/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 63041ae

Please sign in to comment.