WikiLambda
MediaWiki WikiLambda extension
Loading...
Searching...
No Matches
MediaWiki\Extension\WikiLambda\ZErrorFactory Class Reference

Static Public Member Functions

static buildStructureValidationZError ( $errors)
 Root function to transform an array of Opis\JsonSchema\ValidationError objects to a root Z5/ZError object with all the nested errors identified by the built-in Z50/ZErrorTypes.
 
static identifyNestedErrors ( $nestedErrors)
 Recursive function that walks the nested structure of errors and:
 
static identifyError ( $error)
 Given the information provided by the JsonSchema parser about the error (keyword, keywordArgs, data and dataPointer), it tries to match an error type from the error descriptors.
 
static flattenErrors ( $err)
 Given a nested structure of parsing errors found by json-schema, it returns a flat list of errors, with enough information to match them to error type descriptors.
 
static errorMatchesDescriptor ( $error, $descriptor)
 
static getDataType ( $data)
 Given an error data field, which is the partial ZObject in which the error has been found, returns its data type if available.
 
static errorMatchesType ( $error)
 Infers the type of the error data field and returns true if the missing key matches that type.
 
static createZErrorList ( $errorList)
 Create a Z5/ZError of the type Z509/Multiple errors.
 
static createValidationZError (ZError $childError)
 Create a Z5/ZError of the type Z502/Not wellformed.
 
static createAuthorizationZError ( $right, $content, $flags)
 Create a Z5/ZError of the type Z502/Not wellformed.
 
static createKeyValueZError ( $key, $childError)
 Create a Z5/ZError of the type Z526/Key not wellformed.
 
static createArrayElementZError ( $index, $childError)
 Create a Z5/ZError of the type Z522/Array element not wellformed.
 
static createLabelClashZErrors ( $clashes)
 Create a ZError wrapping one or more label clashing errors.
 
static createZErrorInstance ( $zErrorType, $payload)
 Create a Z5/ZError of a given Z50/ZErrorType.
 
static createUnknownValidationError ( $message)
 Create an unknown validation error.
 
static wrapMessageInZError ( $message, $call)
 Convenience method to wrap a non-error in a Z507/Evaluation ZError.
 

Member Function Documentation

◆ buildStructureValidationZError()

static MediaWiki\Extension\WikiLambda\ZErrorFactory::buildStructureValidationZError ( $errors)
static

Root function to transform an array of Opis\JsonSchema\ValidationError objects to a root Z5/ZError object with all the nested errors identified by the built-in Z50/ZErrorTypes.

Parameters
ValidationError[]$errors
Returns
ZError|false
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createArrayElementZError()

static MediaWiki\Extension\WikiLambda\ZErrorFactory::createArrayElementZError ( $index,
$childError )
static

Create a Z5/ZError of the type Z522/Array element not wellformed.

Parameters
string$index
ZError$childError
Returns
ZError
+ Here is the caller graph for this function:

◆ createAuthorizationZError()

static MediaWiki\Extension\WikiLambda\ZErrorFactory::createAuthorizationZError ( $right,
$content,
$flags )
static

Create a Z5/ZError of the type Z502/Not wellformed.

Parameters
string$right
ZObjectContent$content
int$flagswhether is edit EDIT_UPDATE or create EDIT_NEW
Returns
ZError

◆ createKeyValueZError()

static MediaWiki\Extension\WikiLambda\ZErrorFactory::createKeyValueZError ( $key,
$childError )
static

Create a Z5/ZError of the type Z526/Key not wellformed.

Parameters
string$key
ZError$childError
Returns
ZError
+ Here is the caller graph for this function:

◆ createLabelClashZErrors()

static MediaWiki\Extension\WikiLambda\ZErrorFactory::createLabelClashZErrors ( $clashes)
static

Create a ZError wrapping one or more label clashing errors.

Parameters
array$clashes
Returns
ZError
+ Here is the caller graph for this function:

◆ createUnknownValidationError()

static MediaWiki\Extension\WikiLambda\ZErrorFactory::createUnknownValidationError ( $message)
static

Create an unknown validation error.

Parameters
string$message
Returns
ZError
+ Here is the caller graph for this function:

◆ createValidationZError()

static MediaWiki\Extension\WikiLambda\ZErrorFactory::createValidationZError ( ZError $childError)
static

Create a Z5/ZError of the type Z502/Not wellformed.

Parameters
ZError$childError
Returns
ZError
+ Here is the caller graph for this function:

◆ createZErrorInstance()

static MediaWiki\Extension\WikiLambda\ZErrorFactory::createZErrorInstance ( $zErrorType,
$payload )
static

Create a Z5/ZError of a given Z50/ZErrorType.

Parameters
string$zErrorType
array$payload
Returns
ZError
+ Here is the caller graph for this function:

◆ createZErrorList()

static MediaWiki\Extension\WikiLambda\ZErrorFactory::createZErrorList ( $errorList)
static

Create a Z5/ZError of the type Z509/Multiple errors.

Parameters
ZError[]$errorList
Returns
ZError
+ Here is the caller graph for this function:

◆ errorMatchesDescriptor()

static MediaWiki\Extension\WikiLambda\ZErrorFactory::errorMatchesDescriptor ( $error,
$descriptor )
static
Parameters
array$error
array$descriptor
Returns
bool

◆ errorMatchesType()

static MediaWiki\Extension\WikiLambda\ZErrorFactory::errorMatchesType ( $error)
static

Infers the type of the error data field and returns true if the missing key matches that type.

Parameters
array | string$error
Returns
bool

◆ flattenErrors()

static MediaWiki\Extension\WikiLambda\ZErrorFactory::flattenErrors ( $err)
static

Given a nested structure of parsing errors found by json-schema, it returns a flat list of errors, with enough information to match them to error type descriptors.

Parameters
ValidationError$err
Returns
array

◆ getDataType()

static MediaWiki\Extension\WikiLambda\ZErrorFactory::getDataType ( $data)
static

Given an error data field, which is the partial ZObject in which the error has been found, returns its data type if available.

Parameters
array$data
Returns
string|bool

◆ identifyError()

static MediaWiki\Extension\WikiLambda\ZErrorFactory::identifyError ( $error)
static

Given the information provided by the JsonSchema parser about the error (keyword, keywordArgs, data and dataPointer), it tries to match an error type from the error descriptors.

Parameters
array$error
Returns
string|bool
+ Here is the caller graph for this function:

◆ identifyNestedErrors()

static MediaWiki\Extension\WikiLambda\ZErrorFactory::identifyNestedErrors ( $nestedErrors)
static

Recursive function that walks the nested structure of errors and:

  1. when finding a terminal error, identifies it and builds a ZError by matching the error descriptors, and
  2. when finding a non-terminal error, identifies it as a "key not wellformed" builtin error and continues walking the branch. It returns false if no errors could be identified or a root Z5/ZError if with the identified errors.
Parameters
array$nestedErrors
Returns
ZError|bool Z5/ZError or false for no errors found
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wrapMessageInZError()

static MediaWiki\Extension\WikiLambda\ZErrorFactory::wrapMessageInZError ( $message,
$call )
static

Convenience method to wrap a non-error in a Z507/Evaluation ZError.

Parameters
string | ZObject$messageThe non-error to wrap.
string$callThe functional call context.
Returns
ZError

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