'How to update a schema object, after creation, inside a Joi object?

Wasn't sure the best way to phrase the question, but here is an example of what I am trying to do.

const schema = Joi.Object().keys({
   array: Joi.array().length(5)
});

Then after creation I am wanting to update the length method to be a different number.

this.schema.keys({ array: Joi.array().length(8) });

The above code does not work and I'm really just not sure what else to try. (This isn't the only thing I have tried, just where I'm currently at) I've been looking through documentation but haven't found anything helpful for updating a schema. Maybe someone knows of a way to do it?

Any help would be much appreciated!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source