-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
This is definitely something simple I am missing, but I am unable to make the validate or isValid methods return false.
// Test 1:
$data = "asd";
$schema = json_encode(["type" => "object"]);
$result = Jsv4::validate($data, $schema);
print_r($result);
// Jsv4 Object
// (
// [data:Jsv4:private] => asd
// [schema:Jsv4:private] => {"type":"object"}
// [firstErrorOnly:Jsv4:private] =>
// [coerce:Jsv4:private] =>
// [valid] => 1
// [errors] => Array()
// )
// Test 2:
$data = json_encode(["name" => 23]);
$schema = json_encode(["properties" => ["name" => ["type" => "string"]]]);
$result = Jsv4::validate($data, $schema);
print_r($result);
// Jsv4 Object
// (
// [data:Jsv4:private] => {"name":23}
// [schema:Jsv4:private] => {"properties":{"name":{"type":"string"}}}
// [firstErrorOnly:Jsv4:private] =>
// [coerce:Jsv4:private] =>
// [valid] => 1
// [errors] => Array()
// )
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels