Page MenuHomePhabricator

Support declaring multiple 'schemas' inside a single RL module
Closed, DeclinedPublic

Description

Arguably it would be convenient and consistent with other ResourceLoader modules if one could create a single module defining various schemas. Capturing as a bug report so this request and discussion is not lost:

POC:


Version: unspecified
Severity: enhancement

Details

Reference
bz56281

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:15 AM
bzimport set Reference to bz56281.
bzimport added a subscriber: Unknown Object (MLST).

Quoting discussions from those patches:

FOR (Jon)
It's mostly a matter of code hygiene from my perspective and consistency with the rest of ResourceLoader.
ResourceLoader modules consistent of name value pairs.
The names tend to always be plural and the values tend to accept array or strings with the exceptions of position and class.
Thus it is strange to me that schemas do not follow this pattern when there is no reason they cannot.
I think the fact we can currently only have one schema per module is dangerous. In mobile we currently have various active schemas but no central module they are contained. I believe that by grouping all schemas in one module it becomes clearer what schemas are currently active and encourages revisiting whether they should still be active. When writing this patch for example I realised we still have a schema active that measures watch star usage and as far as I know nothing is currently happening with that data and makes me wonder if it should be removed.
Although minimal and less of a concern every module added increases the size of the MediaWiki startup module. As more teams create schemas this will balloon and this is in my eyes unnecessary.

AGAINST (Ori):
I don't think the comparison to the ability to specify multiple CSS or JS files in a single module declaration is apt. A module represents a discrete, logical unit, not a bundle. A collection of schemas is not a logical unit. "The set of schemas we happen to be currently using" describes a group, not a unified whole.
I agree that the current syntax for declaring schema modules is inelegant and repetitive, but I don't think this is the right way to resolve it.
EventLogging falls outside the scope of my current role. The current method for registering schemas as modules is stable and familiar. I am inclined to avoid tampering with it until someone comes along and makes this work their primary focus.

[moving from MediaWiki extensions to Analytics product - see bug 61946]