feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
14.97k stars 744 forks source link

Allow StringEnum to have a default value #3280

Closed AshotN closed 9 months ago

AshotN commented 9 months ago

Steps to reproduce

When creating a Enum you are able to provide a default value.

status: Type.Enum(TRANSACTION_STATUS, { default: TRANSACTION_STATUS.INCOMPLETE }),

But when creating a StringEnum you do not have that option available.

status: StringEnum(['INCOMPLETE', 'COMPLETED', 'CANCELLED', 'APPROVED', 'DECLINED'])

Expected behavior

I would like this to work

status: StringEnum(['INCOMPLETE', 'COMPLETED', 'CANCELLED', 'APPROVED', 'DECLINED'], {
    default: 'COMPLETED'
}),

I can provide a PR for my suggestion to a fix