Closed
Description
Hi!
I use this code (inline scheme)...
`$jsonSchema = <<<'JSON'
{
"type": "object",
"properties": {
"CodigoEmpresa": { "type": "string"},
"Localidade": {"type": "string"}
}
},
"required": ["CodigoEmpresa","Localidade"],
}
JSON;
$jsonSchemaObject = json_decode($jsonSchema);
$schemaStorage = new SchemaStorage();
$schemaStorage->addSchema('file://mySchema', $jsonSchemaObject);
$jsonValidator = new Validator(new Factory($schemaStorage));
// JSON must be decoded before it can be validated
$jsonToValidateObject = json_decode('{"data":123}');
// Do validation (use isValid() and getErrors() to check the result)
$jsonValidator->validate($jsonToValidateObject, $jsonSchemaObject);
if ($jsonValidator->isValid()) {
echo "The supplied JSON validates against the schema.\n";
} else {
echo "JSON does not validate. Violations:\n";
foreach ($jsonValidator->getErrors() as $error) {
printf("[%s] %s\n", $error['property'], $error['message']);
}
}
die();`
But i have this error...
JsonSchema\Exception\ResourceNotFoundException
file_get_contents(file://mySchema): failed to open stream: no suitable wrapper could be found
What is wrong?
thanks!
Metadata
Metadata
Assignees
Labels
No labels