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
I want to validate that only those two keys exist in each object (no extra keys), and that their values are correct (int and string).
Is it possible to validate this with the library? I have tried this:
$validator = v::each(
v::keySet(
v::key("id", v::int()),
v::key("key", v::string())
)
);
// ... at the end of the route ...
})->add(new \DavidePastore\Slim\Validation\Validation($validator));
So far I have not been successful and I am not sure what I am missing.
The text was updated successfully, but these errors were encountered:
Hi @craig-cogdill . Your question makes a lot of sense. At the current state Slim-Validation won't validate payloads that start with an array. This is a limitation and I think that I'll try to find a way to fix the issue.
I created the branch add-array-validation-at-first-position with the fix. Please let me know if you like the solution and if it works as expected. You can also see the code changes here: #40.
More of a help request than an issue...
I have a POST route that takes an array of objects as the body, like this:
I want to validate that only those two keys exist in each object (no extra keys), and that their values are correct (int and string).
Is it possible to validate this with the library? I have tried this:
So far I have not been successful and I am not sure what I am missing.
The text was updated successfully, but these errors were encountered: