amazon-archives / aws-sdk-react-native

AWS SDK for React Native (developer preview)
Apache License 2.0
631 stars 68 forks source link

DynamoDB.DocumentClient #19

Closed adrienjt closed 7 years ago

adrienjt commented 7 years ago

Documents returned by the RN DynamoDB client include explicit types ("S", "L", "M", etc.) and nested values. Working with JS-typed values directly would be easier, as with the JavaScript SDK's DocumentClient: http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html

karthiksaligrama commented 7 years ago

The react native sdk uses the AWS Android and iOS sdk. which currently do not support DynamoDB document client. Once those sdk adds support for the high level we will in-turn add it to the react native sdk.

adrienjt commented 7 years ago

Karthik, your answer is rather unsatisfying. Here is the result of my own investigation, which I hope will lead to this issue being resolved:

I can't speak of the Android SDK, but the iOS SDK sure does implement high-level integration with DynamoDB. However, because Swift/ObjC are statically typed languages, the idiomatic best practice is to define model classes (inheriting from AWSDynamoDBObjectModel and implementing the AWSDynamoDBModeling protocol).

But that doesn't help our case. You'd still need to map the Swift/ObjC types to JavaScript types. In my opinion, the way to go is to simply use the Converter from the AWS JavaScript SDK: https://github.com/aws/aws-sdk-js/blob/master/lib/dynamodb/converter.js