diff options
Diffstat (limited to 'vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go')
-rw-r--r-- | vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go index 07764c8..cf981fe 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go | |||
@@ -87,15 +87,13 @@ func (b *xmlBuilder) buildValue(value reflect.Value, current *XMLNode, tag refle | |||
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | // buildStruct adds a struct and its fields to the current XMLNode. All fields any any nested | 90 | // buildStruct adds a struct and its fields to the current XMLNode. All fields and any nested |
91 | // types are converted to XMLNodes also. | 91 | // types are converted to XMLNodes also. |
92 | func (b *xmlBuilder) buildStruct(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { | 92 | func (b *xmlBuilder) buildStruct(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { |
93 | if !value.IsValid() { | 93 | if !value.IsValid() { |
94 | return nil | 94 | return nil |
95 | } | 95 | } |
96 | 96 | ||
97 | fieldAdded := false | ||
98 | |||
99 | // unwrap payloads | 97 | // unwrap payloads |
100 | if payload := tag.Get("payload"); payload != "" { | 98 | if payload := tag.Get("payload"); payload != "" { |
101 | field, _ := value.Type().FieldByName(payload) | 99 | field, _ := value.Type().FieldByName(payload) |
@@ -123,6 +121,8 @@ func (b *xmlBuilder) buildStruct(value reflect.Value, current *XMLNode, tag refl | |||
123 | child.Attr = append(child.Attr, ns) | 121 | child.Attr = append(child.Attr, ns) |
124 | } | 122 | } |
125 | 123 | ||
124 | var payloadFields, nonPayloadFields int | ||
125 | |||
126 | t := value.Type() | 126 | t := value.Type() |
127 | for i := 0; i < value.NumField(); i++ { | 127 | for i := 0; i < value.NumField(); i++ { |
128 | member := elemOf(value.Field(i)) | 128 | member := elemOf(value.Field(i)) |
@@ -137,8 +137,10 @@ func (b *xmlBuilder) buildStruct(value reflect.Value, current *XMLNode, tag refl | |||
137 | 137 | ||
138 | mTag := field.Tag | 138 | mTag := field.Tag |
139 | if mTag.Get("location") != "" { // skip non-body members | 139 | if mTag.Get("location") != "" { // skip non-body members |
140 | nonPayloadFields++ | ||
140 | continue | 141 | continue |
141 | } | 142 | } |
143 | payloadFields++ | ||
142 | 144 | ||
143 | if protocol.CanSetIdempotencyToken(value.Field(i), field) { | 145 | if protocol.CanSetIdempotencyToken(value.Field(i), field) { |
144 | token := protocol.GetIdempotencyToken() | 146 | token := protocol.GetIdempotencyToken() |
@@ -153,11 +155,11 @@ func (b *xmlBuilder) buildStruct(value reflect.Value, current *XMLNode, tag refl | |||
153 | if err := b.buildValue(member, child, mTag); err != nil { | 155 | if err := b.buildValue(member, child, mTag); err != nil { |
154 | return err | 156 | return err |
155 | } | 157 | } |
156 | |||
157 | fieldAdded = true | ||
158 | } | 158 | } |
159 | 159 | ||
160 | if fieldAdded { // only append this child if we have one ore more valid members | 160 | // Only case where the child shape is not added is if the shape only contains |
161 | // non-payload fields, e.g headers/query. | ||
162 | if !(payloadFields == 0 && nonPayloadFields > 0) { | ||
161 | current.AddChild(child) | 163 | current.AddChild(child) |
162 | } | 164 | } |
163 | 165 | ||