Page MenuHomePhabricator

Reading Lists: create REST module
Closed, ResolvedPublic

Description

The REST API infrastructure now supports "REST Modules". For background, see T366835: REST: API modularization and versioning (tracking) (and its subtasks).

Briefly, a "REST Module" is a set of related endpoints grouped under a name.version portion of the path. For example the endpoints currently available under /v1/page/{title} and /v1/revision/{id} might become /content.v1/page/{title} and /content.v1/revision/{id} respectively.

T365754: REST: Allow extensions to define REST modules introduced the ability for extensions to define modules. Because there are not yet any existing callers to the new Reading Lists REST endpoints, we should move them into a module now, before doing so would require deprecation and migration.

The new module should be called readinglists.v0. Paths like readinglists/v0/lists/setup should instead become readinglists.v0/lists/setup. The module should be specified in a module definition file (among other things, this allows future changes to the endpoint route definitions to be easily identified in git history independently of any changes to extension.json).

This gerrit change was a hackish attempt at this during code review of the original change to introduce modules, and may be useful.

Completion criteria:

  • all endpoints are converted to be defined via module definition file
  • tests are modified as needed (the paths in mocha tests will need tweaked)
  • comments referring to the old paths are updated (most or all of the handlers have such a comment)

Tip: searching for "v0" should find most places that need changed.

Event Timeline

Also, we have not resolved what we want to do with audience designations T366567: REST: introduce audience designations (proposal) yet (or if we want them at all). For now. it might not be a bad idea to include something designation-like in the module name, for example:
"internal:readinglists.v1".

Change #1054972 had a related patch set uploaded (by Aaron Schulz; author: Aaron Schulz):

[mediawiki/extensions/ReadingLists@master] REST: convert routes to spec-based routes using RestModuleFiles

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

aaron changed the task status from Open to In Progress.Jul 18 2024, 3:10 PM
aaron moved this task from Backlog to In Progress on the MW-Interfaces-Team board.

Change #1054972 merged by jenkins-bot:

[mediawiki/extensions/ReadingLists@master] REST: convert routes to spec-based routes using RestModuleFiles

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