withPropertyPaths( array_merge( $path->getPropertyPaths(), [$i] ) ); } /** * Validates an array * * @param mixed $value * @param mixed $schema * @param mixed $i */ protected function checkArray(&$value, $schema = null, ?JsonPointer $path = null, $i = null): void { $validator = $this->factory->createInstanceFor('collection'); $validator->check($value, $schema, $path, $i); $this->addErrors($validator->getErrors()); } /** * Validates an object * * @param mixed $value * @param mixed $schema * @param mixed $properties * @param mixed $additionalProperties * @param mixed $patternProperties * @param array $appliedDefaults */ protected function checkObject( &$value, $schema = null, ?JsonPointer $path = null, $properties = null, $additionalProperties = null, $patternProperties = null, array $appliedDefaults = [] ): void { /** @var ObjectConstraint $validator */ $validator = $this->factory->createInstanceFor('object'); $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults); $this->addErrors($validator->getErrors()); } /** * Validates the type of the value * * @param mixed $value * @param mixed $schema * @param mixed $i */ protected function checkType(&$value, $schema = null, ?JsonPointer $path = null, $i = null): void { $validator = $this->factory->createInstanceFor('type'); $validator->check($value, $schema, $path, $i); $this->addErrors($validator->getErrors()); } /** * Checks a undefined element * * @param mixed $value * @param mixed $schema * @param mixed $i */ protected function checkUndefined(&$value, $schema = null, ?JsonPointer $path = null, $i = null, bool $fromDefault = false): void { /** @var UndefinedConstraint $validator */ $validator = $this->factory->createInstanceFor('undefined'); $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault); $this->addErrors($validator->getErrors()); } /** * Checks a string element * * @param mixed $value * @param mixed $schema * @param mixed $i */ protected function checkString($value, $schema = null, ?JsonPointer $path = null, $i = null): void { $validator = $this->factory->createInstanceFor('string'); $validator->check($value, $schema, $path, $i); $this->addErrors($validator->getErrors()); } /** * Checks a number element * * @param mixed $value * @param mixed $schema * @param mixed $i */ protected function checkNumber($value, $schema = null, ?JsonPointer $path = null, $i = null): void { $validator = $this->factory->createInstanceFor('number'); $validator->check($value, $schema, $path, $i); $this->addErrors($validator->getErrors()); } /** * Checks a enum element * * @param mixed $value * @param mixed $schema * @param mixed $i */ protected function checkEnum($value, $schema = null, ?JsonPointer $path = null, $i = null): void { $validator = $this->factory->createInstanceFor('enum'); $validator->check($value, $schema, $path, $i); $this->addErrors($validator->getErrors()); } /** * Checks a const element * * @param mixed $value * @param mixed $schema * @param mixed $i */ protected function checkConst($value, $schema = null, ?JsonPointer $path = null, $i = null): void { $validator = $this->factory->createInstanceFor('const'); $validator->check($value, $schema, $path, $i); $this->addErrors($validator->getErrors()); } /** * Checks format of an element * * @param mixed $value * @param mixed $schema * @param mixed $i */ protected function checkFormat($value, $schema = null, ?JsonPointer $path = null, $i = null): void { $validator = $this->factory->createInstanceFor('format'); $validator->check($value, $schema, $path, $i); $this->addErrors($validator->getErrors()); } /** * Get the type check based on the set check mode. */ protected function getTypeCheck(): TypeCheck\TypeCheckInterface { return $this->factory->getTypeCheck(); } }