Enable DynamoDB's string set scalar type in your AWS Amplify API!
graphql-stringset-transformer
Installation
npm install --save graphql-stringset-transformer
How to use
Setup custom transformer
Edit amplify/backend/api/<YOUR_API>/transform.conf.json and append "graphql-stringset-transformer" to the transformers field.
"transformers": [
"graphql-stringset-transformer"
]
Use @stringSet directive
Append @stringSet to target fields.
type ExpiringChatMessage @model {
id: ID!
message: String
groups: [String]! @stringSet
}
It is important that the field you use the directive is of type String
Development
- Clone this repository and open it in your code editor.
- Run
npm linkin the cloned project directory andnpm link graphql-stringset-transformerin your test project where you want to use it. Maybe you'll have to uninstall the previously installed dependency as installed from NPM repository. - Run
npm startin your cloned project directory. Every code change is now immediately used in your test project, so you can just modify code and test it usingamplify codegen modelsoramplify push.
Hint: It is important to always make sure the version of the installed graphql dependency matches the graphql version the graphql-transformer-core depends on.
Publish new NPM package version
- Make sure version number is updated.
- Run
npm publish. - Create new release in GitHub including a tag.
License
The MIT License