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

Support default for enum fields

Open pjoe opened this issue 9 months ago • 1 comments

Describe the feature you'd like to request

The enum type doesn't currently support defining default value, e.g. this will not work:

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

pjoe avatar May 10 '24 12:05 pjoe

Hi @pjoe , Thank you for rasing this. we are marking this as a feature request for the team to evaluate further.

AnilMaktala avatar May 10 '24 14:05 AnilMaktala

I would also be interested in this being supported.

thomasoehri avatar May 17 '24 15:05 thomasoehri

ditto

sirkuttin avatar Sep 25 '24 15:09 sirkuttin

Is this related to the issue with making an enum field required? I can't use a.enum().required().

licarpen avatar Oct 21 '24 21:10 licarpen