pplu / aws-sdk-perl

A community AWS SDK for Perl Programmers
Other
171 stars 94 forks source link

Wishlist: Stringify method arguments that are Str #108

Closed rpcme closed 7 years ago

rpcme commented 8 years ago

From #moose: If value is not string, then non-stringified value throws an error:

  PartitionKey => $key

Must be forced into string this way:

  PartitionKey => "$key"
ilmari commented 8 years ago

The specific thing that bit me is that if $key is a pure IV, it'll be serialised as a number in the JSON, which causes Kinesis to return an internal deserialisation exception.

pplu commented 8 years ago

So it looks like we have this problem with Kinesis and DynamoDB (#57) at least...

I think that it can be fixed just mending this line: https://github.com/pplu/aws-sdk-perl/blob/master/lib/Paws/Net/JsonCaller.pm#L34

ilmari commented 8 years ago

No, that line is correct. You'd need to add something like:

elsif ($att_type eq 'Str') {
  ${$key} = "".$params->att;
}
pplu commented 8 years ago

@ilmari you're right :blush:

pplu commented 8 years ago

@ilmari @rpcme I've just pushed commit 7f8f5253498e121dfe3d79af3945b9efc98caadf that tests and solves this for Json and RestJson services (I tried provisioning an EFS file system with a number as the CreationToken, and got "com.amazon.coral.value.json.numbers.TruncatingBigNumber can not be converted to an String" back), so I'm supposing that all JSON services won't accept numbers when they're expecting strings.

Thank you for your help

pplu commented 7 years ago

Hi guys,

This was solved in Paws 0.29 (pushed to CPAN ~ a week ago)