Page MenuHomePhabricator

REST API vNext: create JSON Schemas for the error response body (V1, V2, RESTBase-compat)
Closed, ResolvedPublic2 Estimated Story Points

Description

Following T432799 (api-platform-schemas repo created) and the new error shape, we need to create and publish three JSON Schemas validating the error response body:

  • ErrorFormatterV1 — the legacy error body shape MediaWiki core has emitted so far (errorKey, messageTranslations, message, httpCode, httpReason, reqId? on 5xx).
  • ErrorFormatterV2 — the vNext error shape. [the currently shipped ErrorFormatterV2 (includes/Rest/ErrorFormatterV2.php) produces errorCode, message, messageTranslations, httpCode, tracing{module,request_id,...}. Currently only exercised by the beta module content/v2-beta (errorSchemaVersion: "2.0")
  • RestBaseCompatErrorFormatter — shape for the x-restbase-compat header case: type, title, method, detail, uri, plus the base fields (httpCode, httpReason, errorKey, messageTranslations, reqId?).

Also decide explicitly: additionalProperties policy per schema. Handlers can inject arbitrary extra keys via HttpException::getErrorData() / $extraData — a strict schema breaks on legitimate extras, a fully open one validates nothing.

Push all three to https://gitlab.wikimedia.org/repos/mediawiki/api-platform-schemas, following the repo's folder structure/versioning convention agreed with Andrew and Daniel:

<repo>/
  <repo>/schema.wikimedia.org/   ---> served at https://schema.wikimedia.org/[repositories]/mediawiki/api/
      /fragments/error[s]-v1.json
      /fragments/error[s]-v2[-beta].json        <- naming TBC, see below
      /fragments/error[s]-restbase-compat.json  <- naming TBC, see below
      /oad-archive/content-v1.0.0.json
      /oad-archive/content-v1.0.1.json
      /oad-archive/content-v1.1.0.json
      /specs-archive/

Details

Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
api: Move schemas from mediawiki/api/ to api/repos/mediawiki/api-platform-schemas!2aghirellifix/rename-main-foldermain
Customize query in GitLab

Event Timeline

AGhirelli-WMF set the point value for this task to 2.Sep 17 2026, 4:16 PM