You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we get JsonException when we provide $gender = 'invalid gender' even if we bind a handler to JsonSchemaExceptionHandlerInterface.
I guess this is intentional, because ill-formed requests normally cannot continue and end up with abort. We might need handlers for this if we want to return some error-reason-responses or specify errors in response headers.
Proposal
If this is NOT intentional, we may want to handle JsonExceptions thrown in the request validation here:
@sosuke-ito Sorry for the late response.
What's your use case in practice ? I have no objection to handle bad request with JsonSchemaExceptionHandlerInterface. But I would like to dig deeper beforehand.
JsonSchemaExceptionHandlerInterface
handlesJsonException
s on ill-formed responses but not on ill-formed requests.Is this behavior intentional?
Example
For example, in this test case
BEAR.Resource/tests/Module/JsonSchemaFakeModuleTest.php
Lines 42 to 53 in 6211582
we get
JsonException
when we provide$gender = 'invalid gender'
even if we bind a handler toJsonSchemaExceptionHandlerInterface
.I guess this is intentional, because ill-formed requests normally cannot continue and end up with abort. We might need handlers for this if we want to return some error-reason-responses or specify errors in response headers.
Proposal
If this is NOT intentional, we may want to handle
JsonException
s thrown in the request validation here:BEAR.Resource/src/JsonSchema/Interceptor/JsonSchemaInterceptor.php
Lines 60 to 84 in d28d3ba
Although I've got no good idea. Like this? (maybe BC-break):
The text was updated successfully, but these errors were encountered: