-
Notifications
You must be signed in to change notification settings - Fork 56
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
Allowing empty strings by default for string types #73
Comments
Yeah I think there was a bug around the way joi handled this. |
It isn't an issue with |
This is not fixed yet. Empty string still passes regex validation. |
Hey, how is it possible to get the old behavior back which also allows empty strings? |
Ah I see setting |
Although @svrnwnsch is correct that setting I can see the point of not accepting empty strings if a format (optional part of the JSON schema spec) is set, but could the behavior of v6.0.0 of accepting empty string be restored for strings without formats? |
The
regularString
method makes, by default, an empty string a valid value for almost all string formats. This is a bug, since an empty string is not a valid value for e.g. anipv4
string (which by the JSON Schema spec should be in "dotted quad" format as per RFC 2673).Seems like the original reasoning behind this is that by default
joi
marks an empty string as an invalid value for any string type schema. But as I pointed out this breaks the logic for most string formats.The text was updated successfully, but these errors were encountered: