_regex
filter matching empty string fails in joiValidationErrorItemToErrorExtensions
#22394
Labels
_regex
filter matching empty string fails in joiValidationErrorItemToErrorExtensions
#22394
Describe the Bug
When using a
_regex
filter that is valid in case of an empty string^$
, the conversion from Joi to Directus error fails, as strings are not allowed to be empty in Joi by default1, which generates the errortype
'string.empty'
which is not accounted for in the conversion. We would have to explicitly allow empty strings in the default string schema in case of matching a regex, e.g..allow('')
.I'd like to discuss if it makes sense to allow matching empty strings in the
_regexp
filter or if this can result in breaking changes.To Reproduce
Save as empty string
Matches RegExp
with the RegExp^$|foo
foo
and save the valueDirectus Version
v10.10.7
Hosting Strategy
Self-Hosted (Docker Image)
Footnotes
https://github.com/hapijs/joi/blob/master/API.md#string ↩
The text was updated successfully, but these errors were encountered: