Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Confusing error message #227

Closed
alexsegura opened this issue Apr 2, 2021 · 3 comments
Closed

Confusing error message #227

alexsegura opened this issue Apr 2, 2021 · 3 comments

Comments

@alexsegura
Copy link

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
Copy link
Member

could you please create an example https://php-matcher.norbert.tech/ and share the URL here so I can replicate this issue?

@alexsegura
Copy link
Author

Here it is

@gabrielanhaia
Copy link

@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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants