New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping "timestamp" to time.Time causes error in some APIs #16

Closed
goura opened this Issue Dec 16, 2014 · 1 comment

Comments

Projects
None yet
2 participants
@goura

goura commented Dec 16, 2014

Hi, thank you for your work, your aws-go is super! The world was waiting for this!

DynamoDB.CreateTable() fails with an error like:
parsing time "1418743220.164" as ""2006-01-02T15:04:05Z07:00"": cannot parse "1418743220.164" as """.

I found that this is because "type":"timestamp" is mapped to time.Time, but this API actually returns a UNIX epoch time like "1418743220.164" for CreationDateTime so it can't be unmarshalled to time.Time (its UnmarshalJSON supports RFC3339 timestamps only).

The problem is that most of other AWS APIs returns RFC3339/ISO8601 for "timestamp" type and it works fine.

botocore seems to have it's own parsing logic to handle this problem.
https://github.com/boto/botocore/blob/develop/botocore/utils.py#L277

May be adding aws.TimeStampValue with an UnmarshalJSON like botocore.utils.parse_timestamp is a possible solution.

@stripecodahale

This comment has been minimized.

Show comment
Hide comment
@stripecodahale

stripecodahale Dec 16, 2014

Contributor

Given that there are literally two of these types of fields, I'm just special-casing them to be float64 members. That's a lot easier than making all of the other packages deal with wrapper types.

Contributor

stripecodahale commented Dec 16, 2014

Given that there are literally two of these types of fields, I'm just special-casing them to be float64 members. That's a lot easier than making all of the other packages deal with wrapper types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment