Skip to content

Joi.array() modifies original array #502

@gaastonsr

Description

@gaastonsr

I'm validating an array of times with

var schedule = [
    '08:00',
    '16:00'
];

var result = Joi.validate({
    schedule: schedule
}, {
    schedule: Joi.array().includes(Joi.date().format('HH:mm')).unique().required()
});

After the validation schedule becomes an array of dates when I expect only result.value.schedule to be an array of casted values.

Metadata

Metadata

Assignees

Labels

bugBug or defect

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions