Page MenuHomePhabricator

Support root-level externalDocs in MediaWiki REST Framework OAD generation
Closed, ResolvedPublic3 Estimated Story Points

Description

The Wikimedia OpenAPI linter requires a root-level externalDocs object in every OAD (wikimedia-require-external-docs rule, severity: error). The framework never generates this field and provides no way to set it.

Context

ModuleSpecHandler::run() builds the top-level document with only five keys: openapi, info, servers, paths, components. There is no externalDocs and no way to supply one from a module definition file:

$spec = [
    'openapi'    => '3.0.0',
    'info'       => ...,
    'servers'    => ...,
    'paths'      => ...,
    'components' => ...,
    // ← no 'externalDocs'
];

Note: externalDocs at the *operation* level is already supported (it is in $oasKeys in SpecBasedModule::makeRouteInfo()). Only the root-level field is missing.

4 errors — one per REST module.

Conditions of acceptance

  • Support an externalDocs key in the module definition .json file, readable by SpecBasedModule or ModuleSpecHandler. This key must support an object structure as defined in the OpenAPI specification.
  • When present, include it at the root of the document generated by ModuleSpecHandler::run().
  • Add a unit test verifying the field is passed through correctly.
  • Add the externalDocs object to the MediaWiki REST API OAD with the following values:

Related tasks

  • T425942 (spike that identified this gap)

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:47 PM

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

[mediawiki/core@master] Rest: Support root-level externalDocs in OAD generation

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

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

[mediawiki/extensions/WikimediaCustomizations@master] Rest: Add root-level externalDocs to attribution OAD

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

Change #1298832 merged by jenkins-bot:

[mediawiki/core@master] Rest: Support root-level externalDocs in OAD generation

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

Change #1298833 merged by jenkins-bot:

[mediawiki/extensions/WikimediaCustomizations@master] Rest: Add root-level externalDocs to attribution OAD

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

Resolving tasks as part of closing the sprint.