This is an extension for Opis JSON Schema.
The following additional keywords are provided:
$calculate
evaluate
maxDate
minDate
noIntersect
An array must not contain intersecting intervals.$order
Order arrays. (Only performed, if array has no violations.)precision
$tag
Tagged data can be fetched from a data container after validation.$validations
See tests for how to use them.
The SystopiaValidator
already provides those
keywords. To use them in a different validator class you might want to use
SystopiaSchemaParser
or
SystopiaVocabulary
.
If the option convertEmptyArrays
is set to true
(disabled by default), empty
arrays will be converted to objects if the schema type contains object
, but
not array
. This might be necessary if the data to validate was already
decoded.
This extension allows to translate ValidationError
s:
First create an instance of TranslatorInterface
:
$translator = new Translator($locale, $messages);
If there is a localisation in the messages
directory you can use:
$translator = TranslatorFactory::createTranslator($locale);
Then create an instance of ErrorTranslator
:
$errorTranslator = new ErrorTranslator($translator);
Let the ErrorTranslator
translate a validation error:
echo $errorTranslator->trans($error);