Page MenuHomePhabricator

Introduces support for modules into the REST API framework
Closed, ResolvedPublic

Description

Refactor the MediaWiki\Rest\Router class to support the concept of modules,

Instead of Router operating on a list of endpoint routes directly, it should operate on a list of modules, and each module then manages a list of routes.

This design allows things like versioning and OpenAPI specs to be implemented on the level of modules. It also allows special modules that handle requests in a way different from patch paths and instantiating Hnadler objects.

NOTE: the higher level proposal was moved to T366835. Some of the discussion on this ticket may be referring to things proposed there.

Event Timeline

Change #969811 had a related patch set uploaded (by Daniel Kinzler; author: Daniel Kinzler):

[mediawiki/core@master] Introduce Modules into the REST framework

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

"Modules" is a somewhat unfortunate name IMO, given that the action API calls single endpoints "modules".

There is also ResourceLoader, which refers to its resource bundles as "modules".

"Modules" is a somewhat unfortunate name IMO, given that the action API calls single endpoints "modules".

Yes, it's not ideal... do you have an alternative suggestion?

I was orgiginally going for "component APIs", but that seems more confusing: "component" is already super overloaded, and we keep talking about "the REST API".

There is also ResourceLoader, which refers to its resource bundles as "modules".

Is that a vote for or against?

It seemed to me that we are using the term "module" for "bundle of related things" in api.php and load.php, so using it in rest.php as well should work.

Yes, it's not ideal... do you have an alternative suggestion?
I was orgiginally going for "component APIs", but that seems more confusing: "component" is already super overloaded, and we keep talking about "the REST API".

I think component would be better, as these would typically have the same boundaries as software components.

Alternatively: group, bundle, set, collection, family, suite?

I think “REST API module” is ok, contrasting with “Action API module” and “ResourceLoader module”. I also like “API group” or “API endpoint group”. It’s boring (in a good way), and I think it introduces the least amount of ambiguity.

FJoseph-WMF changed the task status from Open to In Progress.Apr 25 2024, 3:37 PM

Change #1028487 had a related patch set uploaded (by Daniel Kinzler; author: Daniel Kinzler):

[mediawiki/core@master] REST: Emit machine readable directory of available modules

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

Change #969811 merged by jenkins-bot:

[mediawiki/core@master] Introduce Modules into the REST framework

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

Change #1031974 had a related patch set uploaded (by Daniel Kinzler; author: Daniel Kinzler):

[mediawiki/core@master] REST: Add support for RestModules to extension.json

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

daniel renamed this task from Introduces the notion of modules into the REST API framework to Introduces support for modules into the REST API framework.Thu, Jun 6, 6:41 PM
daniel closed this task as Resolved.
daniel updated the task description. (Show Details)
daniel updated the task description. (Show Details)