Skip to content

Commit

Permalink
Ignore __type in Union (#2922)
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Muller <[email protected]>
  • Loading branch information
alextwoods and mullermp authored Oct 4, 2023
1 parent e0da76e commit f6d57e7
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,44 @@
"headers": {},
"body": "{\"UnionMember\": {\"SomeUnknownMember\": \"un-modeled member\"}}"
}
},
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"UnionMember": {"S": "string value"}
},
"resultClass": {
"UnionMember": "UnionType::S"
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"UnionMember\": {\"__type\": \"UnionType\", \"S\": \"string value\"}}"
}
},
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"UnionMember": {"Unknown": {"name": "SomeUnknownMember", "value": "un-modeled member"}}
},
"resultClass": {
"UnionMember": "UnionType::Unknown"
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"UnionMember\": {\"SomeUnknownMember\": \"un-modeled member\", \"__type\": \"UnionType\"}}"
}
}
]
}
Expand Down
2 changes: 2 additions & 0 deletions gems/aws-sdk-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Unreleased Changes
------------------

* Issue - Ignore `__type` when deserializing Unions.

3.185.0 (2023-10-02)
------------------

Expand Down
2 changes: 1 addition & 1 deletion gems/aws-sdk-core/lib/aws-sdk-core/json/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def structure(ref, values, target = nil)
member_name, member_ref = shape.member_by_location_name(key)
if member_ref
target[member_name] = parse_ref(member_ref, value)
elsif shape.union
elsif shape.union && key != '__type'
target[:unknown] = { 'name' => key, 'value' => value }
end
end
Expand Down

0 comments on commit f6d57e7

Please sign in to comment.