Closed kdaker closed 6 years ago
Assume we have the following list of rules to be validated as a application/json post:
$rules = [ 'message' => [ 'notification' => [ 'title' => v::stringType()->length(1, null)->setName("notificationTitle"), 'body' => v::stringType()->length(1, null)->setName("notificationBody"), 'actionName' => v::optional(v::stringType()->length(1, null))->setName("notificationAction") ] ] ];
If I were to post something like this:
{ 'message' : { 'notification' : 1 } }
an error exception is thrown instead of validating that notification should be an object.
notification
Respect seems to have a way to solve with using the key method but we don't have access to that using the middleware. https://github.com/Respect/Validation/issues/317
key
Type: ErrorException Message: array_key_exists() expects parameter 2 to be array, integer given File: /path/vendor/davidepastore/slim-validation/src/Validation.php Line: 163
Hi @kdaker, thanks for opening this issue. You can try and use the 0.5.1 release that includes this bug fix.
will do @DavidePastore , thanks for the fix.
Assume we have the following list of rules to be validated as a application/json post:
If I were to post something like this:
an error exception is thrown instead of validating that
notification
should be an object.Respect seems to have a way to solve with using the
key
method but we don't have access to that using the middleware. https://github.com/Respect/Validation/issues/317exception: