Anomie added a comment.

For ApiComparePages, ApiEditPage, ApiStashEdit, and ApiParse, I need to figure out how exactly the API should accept being passed data for multiple slots to replace the existing text parameters. This will probably take the form of parameter-templates that turn into parameters based on the value of some other parameter.

One possibility is to have the template-parameters reference their parent parameter:

'slots' => [
    ApiBase::PARAM_TYPE => $slotRoles,
    ApiBase::PARAM_ISMULTI => true,
    ApiBase::PARAM_ALL => true,
],
'text-{slot}' => [
    ApiBase::PARAM_IS_TEMPLATE => [ 'slot' => 'slots' ],
    ApiBase::PARAM_TYPE => 'text',
    ApiBase::PARAM_REQUIRED => true,
],
'contentmodel-{slot}' => [
    ApiBase::PARAM_IS_TEMPLATE => [ 'slot' => 'slots' ],
    ApiBase::PARAM_TYPE => ContentHandler::getContentModels(),
],

That would mean you'd pass something like slots=foo|bar&text-foo=...&contentmodel-foo=...&text-bar=...&contentmodel-bar=... when making the query, and the API would recognize all those parameters and validate them properly.

Some notes on other interactions:

  • ApiHelp would add a note about template parameters to the documentation.
  • ApiParamInfo would (regardless of whether these wind up being returned by getAllowedParams() or a new method) separate them out into a 'tempateparameters' array separate from the existing 'parameters' array.
  • ApiSandbox would add or remove fields as appropriate when the value of the named template-for parameter changes.
  • ApiStructureTest might make sure none of the template parameters result in collisions with other parameters for the module (template or non-template).

TASK DETAIL
https://phabricator.wikimedia.org/T174032

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Anomie
Cc: Aklapper, daniel, Lahi, PDrouin-WMF, Gq86, E1presidente, Ramsey-WMF, Cparle, SandraF_WMF, GoranSMilovanovic, QZanden, Tramullas, Acer, LawExplorer, Susannaanas, Aschroet, Jane023, Wikidata-bugs, PKM, Base, matthiasmullie, aude, Ricordisamoa, Lydia_Pintscher, Fabrice_Florin, Raymond, Anomie, Steinsplitter, Mbch331
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to