Check parameters are strings on SWF endpoints

SWF endpoints raise a 400 Bad Request for non-string types, and boto
doesn't enforce it as of today, so better have some safety nets in moto
to avoid this common mistake.

Example exception raised by Boto:

    SWFResponseError: SWFResponseError: 400 Bad Request
    {u'Message': u'class java.lang.Short can not be converted to an String',
    u'__type': u'com.amazon.coral.service#SerializationException'}
This commit is contained in:
Jean-Baptiste Barth 2015-09-30 11:16:02 +02:00
commit 5392978eaf
3 changed files with 44 additions and 6 deletions

View file

@ -30,3 +30,13 @@ class SWFDomainDeprecatedFault(SWFClientError):
super(SWFDomainDeprecatedFault, self).__init__(
domain_name,
"com.amazonaws.swf.base.model#DomainDeprecatedFault")
class SWFSerializationException(JSONResponseError):
def __init__(self):
message = "class java.lang.Foo can not be converted to an String (not a real SWF exception)"
__type = "com.amazonaws.swf.base.model#SerializationException"
super(SWFSerializationException, self).__init__(
400, "Bad Request",
body={"Message": message, "__type": __type}
)