final class SchemaValidator

Validates documents against the bundled JSON Schemas and any local schema they declare.

A declared $schema is either the bundled schema's published URI, which resolves offline, or a local JSON Schema path that adds constraints to the bundled schema.

Constants§

public const BASE = 'https://raw.githubusercontent.com/k-kinzal/ztd-query-php/main/packages/require…

The published location of the bundled schemas, accepted as $schema without a download.

Methods§

public function validate(mixed $data, string $kind, string $file): void

Validates a document.

Parameters

$datamixedThe decoded document
$kindstring"config" or "definition", naming the bundled schema
$filestringThe document file

Throws

InvalidInputException When the document breaks a schema, or declares a remote or unreadable one
JsonException When a schema is not JSON
Test cases 10
Called from 1
Calls 10
public static function path(string $name): string

Returns the path of a bundled schema.

Parameters

$namestringThe schema file name

Returns

string The path within the package's schemas directory
Test cases 1
Called from 2
Calls 1

Test cases 29§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 14
Other tests reaching this symbol 15

Relations§

Instantiated in 1
Static calls 1
Method calls 1