hotmeteor / spectator

OpenAPI testing for PHP
MIT License
285 stars 52 forks source link

Feature/allow schema problem json #102

Closed pedrosalpr closed 2 years ago

pedrosalpr commented 2 years ago

This feature allows when an API returns errors in the pattern of RFC7807, in which the content-type returned is application/problem+json passes contract validation tests.

The reason for this feature is because it has an API following this pattern and when testing the tests with error, it returns

• Tests\Contract\States\StateContractTest > returns 500 for list states
    ErrorException

   Unable to map [application/problem+json] to schema type [object].
Failed asserting that true is false.

And when you add the content-type application/problem+json to the ResponseValidator in the body method, the test is accepted.

hotmeteor commented 2 years ago

Hi @pedrosalpr, thanks for your contribution. This issue was resolved in a different branch (https://github.com/hotmeteor/spectator/pull/104) and will be in the next release.