MediaWiki REL1_34
AvroValidator Class Reference

Generate error strings for data that doesn't match the specified Avro schema. More...

Static Public Member Functions

static getErrors (AvroSchema $schema, $datum)
 
static outOfRange ( $min, $max, $datum)
 
static typeOf ( $datum)
 
static wrongType ( $expected, $datum)
 

Detailed Description

Generate error strings for data that doesn't match the specified Avro schema.

This is very similar to AvroSchema::is_valid_datum(), but returns error messages instead of a boolean.

Since
1.26
Author
Erik Bernhardson ebern.nosp@m.hard.nosp@m.son@w.nosp@m.ikim.nosp@m.edia..nosp@m.org
Note
© 2015 Erik Bernhardson and Wikimedia Foundation.

Definition at line 30 of file AvroValidator.php.

Member Function Documentation

◆ getErrors()

static AvroValidator::getErrors ( AvroSchema $schema,
$datum )
static
Parameters
AvroSchema$schemaThe rules to conform to.
mixed$datumThe value to validate against $schema.
Returns
string|string[] An error or list of errors in the provided $datum. When no errors exist the empty array is returned. PhanUndeclaredMethod,PhanUndeclaredProperty

Definition at line 39 of file AvroValidator.php.

Referenced by MediaWiki\Logger\Monolog\AvroFormatter\format().

◆ outOfRange()

static AvroValidator::outOfRange ( $min,
$max,
$datum )
static

Definition at line 180 of file AvroValidator.php.

◆ typeOf()

static AvroValidator::typeOf ( $datum)
static

Definition at line 172 of file AvroValidator.php.

◆ wrongType()

static AvroValidator::wrongType ( $expected,
$datum )
static

Definition at line 176 of file AvroValidator.php.


The documentation for this class was generated from the following file: