public function validate($value)
    {
        $validator = new Validator();
        $jsonSchema = $this->json;

        $validator->check($value, $jsonSchema);

        if (!$validator->isValid()) {
            foreach ($validator->getErrors() as $error) {
                $this->errors[] = new TypeValidationError($error['property'], $error['constraint']);
            }
        }
    }
public function validate($value)
    {
        $validator = new Validator();
        $jsonSchema = $this->json;

        $validator->check($value, $jsonSchema);

        if (!$validator->isValid()) {
            foreach ($validator->getErrors() as $error) {
                $this->errors[] = new TypeValidationError($error['property'], $error['constraint']);
            }
        }
    }
public function validate ( $ value ) { $ validator = new Validator ( ) ; $ jsonSchema = $ this -> json ; $ validator -> check ( $ value , $ jsonSchema ) ; if ( ! $ validator -> isValid ( ) ) { foreach ( $ validator -> getErrors ( ) as $ error ) { $ this -> errors [ ] = new TypeValidationError ( $ error [ 'property' ] , $ error [ 'constraint' ] ) ; } } }
Validate a JSON string against the schema
- Converts the string into a JSON object then uses the JsonSchema Validator to validate
Validate a JSON string against the schema - Converts the string into a JSON object then uses the JsonSchema Validator to validate