aws-amplify / aws-amplify/amplify-data
Support default for enum fields
- Dominant language
- TypeScript
- Stars
- 18
- Forks
- 23
- Avg merge
- 26m
- Merged PRs (30d)
- 1
Description
### Describe the feature you'd like to request
The enum type doesn't currently support defining default value, e.g. this will not work:
```ts
a.enum(["a", "b"]).default("a")
```
### Describe the solution you'd like
Code like above works, just like with other field types.
### Describe alternatives you've considered
Had to use another field type (boolean or integer)
### Additional context
_No response_
### Is this something that you'd be interested in working on?
- [ ] 👋 I may be able to implement this feature request
### Would this feature include a breaking change?
- [ ] ⚠️ This feature might incur a breaking change
Contributor guide
Research direction
Start by locating how enum fields and defaults are handled for other field types in the TypeScript repository. Verify the enum example with a default value and add or update coverage so completion is demonstrated by the example working like other field types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100