-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
breaking changesChange that can breaking existing codeChange that can breaking existing codefeatureNew functionality or improvementNew functionality or improvement
Milestone
Description
Context
- joi version:
10.2.2
What are you trying to achieve or the steps to reproduce ?
Currently, calling e.g. .min() multiple times just accumulates the rules (as it should), but in this case it doesn't make sense.
Suppose I have a library of schemas, and the default for some array is .min(1).. if I want to re-use the schema but override it to allow 0 members, I can't AFAIK.
Joi.array().min(0).min(1)
should IMO override the 0 with 1.
I understand that for some rules it'd be hard to determine what should override what -- particularly when trying to override one rule with a different one (e.g. min(1).allow([])), but I think that it might not be hard to specify a list of rules which override themselves (min, max etc.).
Thoughts?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
breaking changesChange that can breaking existing codeChange that can breaking existing codefeatureNew functionality or improvementNew functionality or improvement