Confusing error message
alexsegura opened this issue ยท 3 comments
alexsegura commented
Hi.
Thank you for making PHP Matcher ๐
With a PHP Matcher expectation like this:
{
"@context":"/api/contexts/ConstraintViolationList",
"@type":"ConstraintViolationList",
"hydra:title":"An error occurred",
"hydra:description":@string@,
"violations":[
{
"propertyPath":"total",
"message":@string@,
"code":""
}
]
}
If [violations][0][code]
is null
null, PHP Matcher gives the following message
Value "" does not match pattern "" at path: "[violations][0][code]"
This is confusing, when seeing this you wonder why "" !== ""
๐ค
Maybe it could be instead:
Value null does not match pattern "" at path: "[violations][0][code]"
norberttech commented
could you please create an example https://php-matcher.norbert.tech/ and share the URL here so I can replicate this issue?
alexsegura commented
gabrielanhaia commented
@alexsegura I was just wondering why haven't used @null@
as in the documentation?
If you do so as for the other kind of validations, the error will be more clear: LIKE HERE