This patch emits deprecation warnings when extensions override Handler::getBodyValidator() or otherwise use JsonBodyValidator. Request body validation should be performed based on body parameter declarations returned from getBodyParamSettings(). Bug: T358560 Depends-On: I8b12c9c9d5a73c620e3c5d035f815d7c951c7b30 Change-Id: I44b3395b8d2489c5e7ec8de0077fd7a7c9f49bfe
31 lines
804 B
PHP
31 lines
804 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Rest\Validator;
|
|
|
|
use MediaWiki\Rest\HttpException;
|
|
use MediaWiki\Rest\RequestInterface;
|
|
|
|
/**
|
|
* Interface for validating a request body
|
|
*
|
|
* @deprecated since 1.43, because Handler::getBodyValidator() is deprecated.
|
|
* No longer stable to implement.
|
|
*
|
|
* @see \MediaWiki\Rest\Handler::getBodyValidator()
|
|
*/
|
|
interface BodyValidator {
|
|
|
|
/**
|
|
* 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().
|
|
*
|
|
* @param RequestInterface $request
|
|
* @return mixed|null
|
|
* @throws HttpException on validation failure
|
|
*/
|
|
public function validateBody( RequestInterface $request );
|
|
|
|
}
|