Skip to content

Commit

Permalink
Add tests to verify that type is ignored in union types during deseri…
Browse files Browse the repository at this point in the history
…alization (#4457)
  • Loading branch information
zoewangg authored Sep 21, 2023
1 parent c13710d commit 5ea3c40
Show file tree
Hide file tree
Showing 3 changed files with 197 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -702,4 +702,23 @@
}
}
}
,
{
"description": "Ignores an unrecognized __type property",
"given": {
"response": {
"status_code": 200,
"body": "{\"UnionMember\": {\"StringMember\":\"foobar\", \"__type\": \"aws.protocoltests.json10#MyUnion\"}}"
}
},
"when": {
"action": "unmarshall",
"operation": "AllTypes"
},
"then": {
"deserializedAs": {
"UnionMember": {"StringMember":"foobar"}
}
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@
"MapOfEnumToEnum":{"shape":"MapOfEnumToEnum"},
"ListOfTimeStamp":{"shape":"ListOfTimeStamp"},
"MapOfTimeStamp":{"shape":"MapOfTimeStamp"},
"MyDocument":{"shape":"MyDocument"}
"MyDocument":{"shape":"MyDocument"},
"UnionMember":{"shape":"AllTypesUnionStructure"}
}
},
"BaseType":{
Expand Down Expand Up @@ -314,6 +315,93 @@
"MyDocument": {
"type": "structure",
"document": true
},
"AllTypesUnionStructure": {
"type": "structure",
"union": true,
"members": {
"StringMember": {
"shape": "String"
},
"IntegerMember": {
"shape": "Integer"
},
"BooleanMember": {
"shape": "Boolean"
},
"FloatMember": {
"shape": "Float"
},
"DoubleMember": {
"shape": "Double"
},
"LongMember": {
"shape": "Long"
},
"ShortMember": {
"shape": "Short"
},
"EnumMember": {
"shape": "EnumType"
},
"SimpleList": {
"shape": "ListOfStrings"
},
"ListOfEnums": {
"shape": "ListOfEnums"
},
"ListOfMaps": {
"shape": "ListOfMapStringToString"
},
"ListOfStructs": {
"shape": "ListOfSimpleStructs"
},
"MapOfStringToIntegerList": {
"shape": "MapOfStringToIntegerList"
},
"MapOfStringToString": {
"shape": "MapOfStringToString"
},
"MapOfStringToStruct": {
"shape": "MapOfStringToSimpleStruct"
},
"MapOfEnumToEnum": {
"shape": "MapOfEnumToEnum"
},
"TimestampMember": {
"shape": "Timestamp"
},
"StructWithNestedTimestampMember": {
"shape": "StructWithTimestamp"
},
"BlobArg": {
"shape": "BlobType"
},
"StructWithNestedBlob": {
"shape": "StructWithNestedBlobType"
},
"BlobMap": {
"shape": "BlobMapType"
},
"ListOfBlobs": {
"shape": "ListOfBlobsType"
},
"RecursiveStruct": {
"shape": "RecursiveStructType"
},
"PolymorphicTypeWithSubTypes": {
"shape": "BaseType"
},
"PolymorphicTypeWithoutSubTypes": {
"shape": "SubTypeOne"
},
"SetPrefixedMember": {
"shape": "String"
},
"UnionMember": {
"shape": "AllTypesUnionStructure"
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@
"MapOfEnumToEnum":{"shape":"MapOfEnumToEnum"},
"ListOfTimeStamp":{"shape":"ListOfTimeStamp"},
"MapOfTimeStamp":{"shape":"MapOfTimeStamp"},
"MyDocument":{"shape":"MyDocument"}
"MyDocument":{"shape":"MyDocument"},
"UnionMember":{"shape":"AllTypesUnionStructure"}
}
},
"BaseType":{
Expand Down Expand Up @@ -953,6 +954,93 @@
"members":{
"DocumentMember":{"shape":"MyDocument"}
}
},
"AllTypesUnionStructure": {
"type": "structure",
"union": true,
"members": {
"StringMember": {
"shape": "String"
},
"IntegerMember": {
"shape": "Integer"
},
"BooleanMember": {
"shape": "Boolean"
},
"FloatMember": {
"shape": "Float"
},
"DoubleMember": {
"shape": "Double"
},
"LongMember": {
"shape": "Long"
},
"ShortMember": {
"shape": "Short"
},
"EnumMember": {
"shape": "EnumType"
},
"SimpleList": {
"shape": "ListOfStrings"
},
"ListOfEnums": {
"shape": "ListOfEnums"
},
"ListOfMaps": {
"shape": "ListOfMapStringToString"
},
"ListOfStructs": {
"shape": "ListOfSimpleStructs"
},
"MapOfStringToIntegerList": {
"shape": "MapOfStringToIntegerList"
},
"MapOfStringToString": {
"shape": "MapOfStringToString"
},
"MapOfStringToStruct": {
"shape": "MapOfStringToSimpleStruct"
},
"MapOfEnumToEnum": {
"shape": "MapOfEnumToEnum"
},
"TimestampMember": {
"shape": "Timestamp"
},
"StructWithNestedTimestampMember": {
"shape": "StructWithTimestamp"
},
"BlobArg": {
"shape": "BlobType"
},
"StructWithNestedBlob": {
"shape": "StructWithNestedBlobType"
},
"BlobMap": {
"shape": "BlobMapType"
},
"ListOfBlobs": {
"shape": "ListOfBlobsType"
},
"RecursiveStruct": {
"shape": "RecursiveStructType"
},
"PolymorphicTypeWithSubTypes": {
"shape": "BaseType"
},
"PolymorphicTypeWithoutSubTypes": {
"shape": "SubTypeOne"
},
"SetPrefixedMember": {
"shape": "String"
},
"UnionMember": {
"shape": "AllTypesUnionStructure"
}
}
}
}
}

0 comments on commit 5ea3c40

Please sign in to comment.