API: Introduce "templated parameters"
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 4 Apr 2018 20:22:01 +0000 (16:22 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Wed, 16 May 2018 20:19:31 +0000 (16:19 -0400)
commit78d1b8ebba6e992c59c7f7c02fd621bc6f12547c
tree42e3714c4bb161ccc74b99d5494789c231f96898
parent1d1633307af930d5465ba85ee099a057399065ca
API: Introduce "templated parameters"

With MCR coming up, ApiEditPage is going to need to be able to take
"text" and "contentmodel" parameters for each slot-role, and enumerating
such parameters for every possible slot would probably get rather
confusing as to what is required when, or at least long-winded in
repeating the exact same thing for every possible role.

So let's abstract it: we'll have an "editroles" parameter to specify which
slots are being edited, and ApiEditPage will just declare that
"text-{role}" and "contentmodel-{role}" parameters should exist for each
value of "editroles" in the submission.

Note this patch doesn't introduce anything that uses templated
parameters, just the functionality itself. For testing purposes you
might cherry pick I2d658e9a.

Bug: T174032
Change-Id: Ia19a1617b73067bfb1f0f16ccc57d471778b7361
13 files changed:
RELEASE-NOTES-1.32
includes/api/ApiBase.php
includes/api/ApiHelp.php
includes/api/ApiMain.php
includes/api/ApiParamInfo.php
includes/api/i18n/en.json
includes/api/i18n/qqq.json
languages/i18n/en.json
languages/i18n/qqq.json
resources/Resources.php
resources/src/mediawiki.special.apisandbox/apisandbox.js
tests/phpunit/includes/api/ApiBaseTest.php
tests/phpunit/structure/ApiStructureTest.php