8000 Allow StringEnum to have a default value · Issue #3280 · feathersjs/feathers · GitHub
[go: up one dir, main page]

Skip to content

Allow StringEnum to have a default value #3280

@AshotN

Description

@AshotN

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0