Page MenuHomePhabricator

Rich Attributes Phase 3 Alternative 3c: implicit schema via attribute registry
Open, Needs TriagePublic

Description

A patch to JsonCodec added "abbreviation" support to the codec. This allows using arbitary strings to abbreviate full type hints. We can implement the rich attribute accessors to default to a type abbreviation based on the attribute name, for example @attr-data-mw when getting/setting the value of the data-mw attribute. The codec is initialized with a mapping from abbreviations to type hints, which serves as the de facto schema for the document. We can detect the presence of attributes with rich data by consulting the abbreviation map (aka, schema): if there is an attribute named foo on the element and there's a hint defined for @attr-foo, then we should load the value of that attribute when traversing content. This doesn't in itself tell us where in the loaded value an embedded document fragment might be located, but perhaps an interface method could be defined for this purpose. This ties the schema and the codec fairly tightly to the PHP implementation, and mostly abandons the idea of a separate implementation-independent schema, but it would still be possible to port the codec and traversal code to other languages.

Event Timeline

Change #1236842 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/services/parsoid@master] WIP: Parsoid Extension modules can now register codec hints for new attributes

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

Change #1236842 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Parsoid Extension modules can now register codec hints for new attributes

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

Change #1299571 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.24.0-a8

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

Change #1299571 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.24.0-a8

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

Change #1299588 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/vendor@wmf/1.47.0-wmf.6] Bump wikimedia/parsoid to 0.24.0-a8

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

Change #1299588 merged by jenkins-bot:

[mediawiki/vendor@wmf/1.47.0-wmf.6] Bump wikimedia/parsoid to 0.24.0-a8

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

Mentioned in SAL (#wikimedia-operations) [2026-06-09T20:39:15Z] <cscott@deploy1003> Started scap sync-world: Backport for [[gerrit:1299588|Bump wikimedia/parsoid to 0.24.0-a8 (T378906 T420336 T424427 T427664 T427972 T428452 T428270)]], [[gerrit:1299589|Bump wikimedia/parsoid to 0.24.0-a8 (T428270)]]

Mentioned in SAL (#wikimedia-operations) [2026-06-09T20:50:28Z] <cscott@deploy1003> Finished scap sync-world: Backport for [[gerrit:1299588|Bump wikimedia/parsoid to 0.24.0-a8 (T378906 T420336 T424427 T427664 T427972 T428452 T428270)]], [[gerrit:1299589|Bump wikimedia/parsoid to 0.24.0-a8 (T428270)]] (duration: 11m 13s)