Somewhat related to this issue:
https://github.com/lightsofapollo/joi-to-json-schema/issues/11
From what I can tell, currently .allow() and .valid() both just whitelist the given values and blacklist everything else. I think this change should make it so that .allow whitelists the given values while still allowing all values of the original type. I have found this useful for cases where schema users do things such as:
Joi.string().allow(null)
Edit: Also made a last minute change from oneOf to anyOf because I think that oneOf could be problematic in cases where you are allowing an instance of type (which shouldn't be done but still could be) such as
Somewhat related to this issue: https://github.com/lightsofapollo/joi-to-json-schema/issues/11 From what I can tell, currently
.allow()
and.valid()
both just whitelist the given values and blacklist everything else. I think this change should make it so that.allow
whitelists the given values while still allowing all values of the original type. I have found this useful for cases where schema users do things such as:Edit: Also made a last minute change from oneOf to anyOf because I think that oneOf could be problematic in cases where you are allowing an instance of type (which shouldn't be done but still could be) such as