Closed
Description
I'm a bit confused about how to combine different validation techniques. As i understand it, I can use CHECK_MODE_COERCE_TYPES to check types objects, arrays, integers, strings etc. as well as parameter requirements maxLength, minLength (strings), maximium, minimum (integers) etc.
However, if I also want to check if a parameter is an email string, I need to use FormatValidation (CHECK_MODE_COERCE_TYPES apparently only checks if the email parameter is a string).
So - I suppose I need to combine FormatValidation and CHECK_MODE_COERCE_TYPES. I'm not sure how to do that properly.
$validator = new \JsonSchema\Validator();
$validator->validate(
$postedArray,
$schema,
Constraint::CHECK_MODE_COERCE_TYPES);
$validator->validate(
$postedArray,
$schema,
Constraint::CHECK_MODE_FormatConstraint);
I'm looking for something like this, but I assume this is not the proper way to go about it..?
Metadata
Metadata
Assignees
Labels
No labels