Skip to content

Add simple enum validator (that can be any of type) #21

@evilandfox

Description

@evilandfox

Hi! Thanks for your great tool)
I think "enum" validator will be very userful. At this time this is available for string validator. But, for example, I often use numeric enums in REST API as parameters.
I know that it can be made by using multiple validators. But that will be great to write like:

let schema = {
    status: { type: "enum", values: [null, 1, 2, "done"] }
}
v.validate({ status: "done" }, schema)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions