amplify-category-api icon indicating copy to clipboard operation
amplify-category-api copied to clipboard

Support Set Types in GraphQL Schema backed by DynamoDB

Open iyz91 opened this issue 4 years ago • 8 comments

Is your feature request related to a problem? Please describe. For AppSync GraphQL API backed by DynamoDB, it can be useful and potentially more performant to allow sets (e.g. string set) for fields that fit.

Describe the solution you'd like An ideal implementation would be some sort of directive like @set that would apply the correct DynamoDB helper inferred from the field type. For example, members: [String!] @set would implement $util.dynamodb.toStringSetJson() in the mutation's request template and elsewhere. Alternatively, @stringset would also work to skip the inferring step.

Additional context By default, Amplify's GQL transformer utilizes $util.dynamodb.toMapValuesJson(Map) which is "opinionated about how it represents some of the nested objects: e.g., it will use lists (“L”) rather than sets (“SS”, “NS”, “BS”)." (here).

iyz91 avatar Feb 02 '21 00:02 iyz91