Page MenuHomePhabricator

Support requestBody.description in MediaWiki REST Framework OAD generation
Closed, ResolvedPublic3 Estimated Story Points

Description

The Wikimedia OpenAPI linter requires a description field on every requestBody object (wikimedia-requestbody-description rule, severity: error). Currently the MediaWiki REST Framework never generates this field and there is no mechanism to set it.

Context

Handler::getRequestSpec() builds the requestBody object from getBodyParamSettings(), but only produces required and content. There is no way to add a description — neither from handler PHP code nor from route definition .json files:

return [
    // ← no 'description' field
    'required' => ...,
    'content'  => [ ... ]
];

This affects every POST/PUT handler that has a request body (e.g. PUT /v1/page/{title}, POST /v1/transform/html/to/wikitext). 14 errors across all REST modules.

Conditions of acceptance

  • Add a way to supply a description for the request body — either a getRequestBodyDescription() method on the Handler base class (returning null by default, overridable by subclasses), or support for declaring it in route definition .json files.
  • When the description is present, include it in the requestBody object produced by getRequestSpec().
  • Add a unit test verifying the field appears in the generated spec when provided.

Related tasks

  • T425942 (spike that identified this gap)
  • T425428 (operationId — similar framework gap, same area of code)

Event Timeline

KBach triaged this task as High priority.May 27 2026, 11:50 AM
OWresch-WMF set the point value for this task to 3.May 28 2026, 3:46 PM
KBach lowered the priority of this task from High to Medium.Jun 2 2026, 8:35 AM

Change #1300910 had a related patch set uploaded (by Aghirelli; author: Aghirelli):

[mediawiki/core@master] Rest: Add getRequestBodyDescription() to Handler base class

https://gerrit.wikimedia.org/r/1300910

Change #1300910 merged by jenkins-bot:

[mediawiki/core@master] Rest: Add getRequestBodyDescription() to Handler base class

https://gerrit.wikimedia.org/r/1300910

Resolving tasks as part of closing the sprint.