-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider renaming 'valid' to 'enum' or an alias #536
Comments
I'm not really convinced by your arguments, I'll let it open to see if other people have similar opinion. What would be the opposite of enum (invalid)? |
I don't know about the language issue, but from the naming I would expect As for |
@kanongil allow and disallow would be better then valid/valid, If not enum, I would be for these names for those methods. |
Would something like |
I like |
I favor |
So let me sum this up :
Is everyone OK with this or do we still need to debate that last one ? |
Love it. I expected this issue to be closed as irrelevant. I am truly glad that you accepted it and acted on it. :+1 |
👍 |
@Marsup Would you be opposed to a PR which modifies the documentation for |
OK, just an aka somewhere would do. |
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
I think that the method 'valid' which allows to specify/ENUMERATE the allowed values should be renamed to enum.
Reasons?
For someone new who hasn't memoired the API yet, 'valid' can be confused with the actual validation, also 'enum' is a term known in many type-safe languages which means exactly this and Mongoose uses it too. Googling joi valid doesn't yield anything related to enumerations, because Google is picking all the mentions of Joi.validate method.
Last, but not least when teaching someone and dictating code it can get confusing-especially for people from foreign countries.
Or just create an alias 'enum'?
I haven't used Joi very extensively yet, but I think there should not be a problem to just deprecate 'valid' and add enum() from next major version.
The text was updated successfully, but these errors were encountered: