MediaWiki  master
MediaWiki\Rest\Validator\JsonBodyValidator Class Reference

Do-nothing body validator. More...

Inheritance diagram for MediaWiki\Rest\Validator\JsonBodyValidator:
Collaboration diagram for MediaWiki\Rest\Validator\JsonBodyValidator:

Public Member Functions

 __construct (array $bodyParamSettings)
 
 validateBody (RequestInterface $request)
 Validate the body of a request. More...
 

Private Attributes

array[] $bodyParamSettings
 

Detailed Description

Do-nothing body validator.

Definition at line 14 of file JsonBodyValidator.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Rest\Validator\JsonBodyValidator::__construct ( array  $bodyParamSettings)
Parameters
array[]$bodyParamSettings

Definition at line 24 of file JsonBodyValidator.php.

References MediaWiki\Rest\Validator\JsonBodyValidator\$bodyParamSettings.

Member Function Documentation

◆ validateBody()

MediaWiki\Rest\Validator\JsonBodyValidator::validateBody ( RequestInterface  $request)

Validate the body of a request.

This may return a data structure representing the parsed body. When used in the context of Handler::validateParams(), the returned value will be available to the handler via Handler::getValidatedBody().

Parameters
RequestInterface$request
Returns
mixed
Exceptions
HttpExceptionon validation failure

Implements MediaWiki\Rest\Validator\BodyValidator.

Definition at line 28 of file JsonBodyValidator.php.

References FormatJson\FORCE_ASSOC, MediaWiki\Rest\RequestInterface\getBody(), Wikimedia\ParamValidator\ParamValidator\PARAM_DEFAULT, Wikimedia\ParamValidator\ParamValidator\PARAM_REQUIRED, and FormatJson\parse().

Member Data Documentation

◆ $bodyParamSettings

array [] MediaWiki\Rest\Validator\JsonBodyValidator::$bodyParamSettings
private

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