aws-amplify / aws-amplify/amplify-codegen
RFC: Amplify codegen generating enums.js file in src/graphql folder
- Dominant language
- TypeScript
- Stars
- 59
- Forks
- 64
- PR merge metrics
- No merged PRs in 30d
Description
**Problem:**
Currently Amplify codegen generates GraphQL statements(queries, mutations and eventHandlers), but doesn't address the enums.
Quite often we define some "lookup" values in enums, which can change over time. When changes happen, updates have to be done on the both sides, back-end and front-end. This leads to potential discrepancies, and unnecessary work on both sides.
**Solution:**
The process of updating enums would be simplified and discrepancies avoided, by Amplify codegen generating an additional file beside queries, mutations, and subscriptions, called enums.js. That file would contain lookup values, which, once imported, would always provide updated values without a need to do any updates on the client side.
**Developer Experience:**
```
$ amplify codegen
Result (graphql folder):
$ ls src/graphql
mutations.js queries.js subscriptions.js enums.js
Client side:
import { orderStatus } from '../../graphql/enums'
```
Contributor guide
Assessment
This issue has not been assessed yet.