Method | Description | |
---|---|---|
__construct ( JsonSchema\Validator $validator = null, JsonSchema\Uri\UriRetriever $uriRetriever = null, JsonSchema\UriResolverInterface $uriResolver = null ) | JsonValidator constructor. | |
validate ( mixed $data, string | object | null $schema = null ) : string[] | Validates JSON data against a schema. |
Method | Description | |
---|---|---|
assertSchemaValid ( $schema ) | ||
loadSchema ( $file ) |
public __construct ( JsonSchema\Validator $validator = null, JsonSchema\Uri\UriRetriever $uriRetriever = null, JsonSchema\UriResolverInterface $uriResolver = null ) | ||
$validator | JsonSchema\Validator | JsonSchema\Validator instance to use |
$uriRetriever | JsonSchema\Uri\UriRetriever | The retriever for fetching JSON schemas |
$uriResolver | JsonSchema\UriResolverInterface | The resolver for URIs |
public validate ( mixed $data, string | object | null $schema = null ) : string[] | ||
$data | mixed | The decoded JSON data |
$schema | string | object | null | The schema file or object. If `null`, the validator will look for a `$schema` property |
return | string[] | The errors found during validation. Returns an empty array if no errors were found |