MediaWiki  1.30.0
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.

Definition at line 38 of file AvroValidator.php.

References $name, as, outOfRange(), and wrongType().

Referenced by MediaWiki\Logger\Monolog\AvroFormatter\format(), and AvroValidatorTest\testGetErrors().

◆ outOfRange()

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

Definition at line 178 of file AvroValidator.php.

Referenced by getErrors().

◆ typeOf()

static AvroValidator::typeOf (   $datum)
static

Definition at line 170 of file AvroValidator.php.

Referenced by wrongType().

◆ wrongType()

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

Definition at line 174 of file AvroValidator.php.

References typeOf().

Referenced by getErrors().


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