3 Answers
- Newest
- Most votes
- Most comments
0
Hi,
That feature request makes sense to me, I'll bring it back to the team for discussion and prioritization. Thanks for the feedback!
Thanks,
Jeff
answered 5 years ago
0
It is a long time since this question was posted and indeed the AppSync team added the requested functionality.
First, they added to the context object the selection set list (ctx.info.selectionSetList
).
Second, they updated the DynamoDB Tutorial to include an example of using the selection set list as the projection argument to DynamoDB, as suggested:
import { util } from '@aws-appsync/utils';
export function request(ctx) {
return dynamoDBGetItemRequest(ctx);
}
export function response(ctx) {
return ctx.result;
}
/**
* A helper function to get a DynamoDB item
*/
function dynamoDBGetItemRequest(ctx) {
return {
operation: 'GetItem',
key: util.dynamodb.toMapValues({ id: ctx.args.id}),
projection: {
expression : ctx.info.selectionSetList.join(",")
}
}
}
answered a year ago
Relevant content
- asked 3 months ago
- asked 3 years ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago