Skip to content

do ref-able operations support referring to a list? #583

@stephen-bartell

Description

@stephen-bartell

the following results in an error. i'm trying to get it to determine if foo is one of 'bar', 'baz', or 'quux'. context.fooType is determined dynamically at runtime and passed into the validation.

var obj = { foo: 'bar' }
var schema = Joi.object({ foo: Joi.any().valid('$fooTypes') })

Joi.validate(data, schema, { context: { fooTypes: [ 'bar', 'baz', 'quux' ] } })

is there a way to accomplish this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug or defect

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions