Page MenuHomePhabricator

ParserOutput::setSections() should be more structured
Closed, ResolvedPublic

Description

ParserOutput::setSections() currently takes a untyped array as argument. It should instead take something like an array<SectionMetadata> to provide stronger typing on the value and structure (where SectionMetadata is a value object).

Probably add something like ::setSectionMetadata(...new type...) and then have ::getSections() return $this->sectionMetadata->getLegacyArray() and also use the legacy array in the serialization for back compat.

Related Objects

StatusSubtypeAssignedTask
OpenReleaseNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenFeatureNone
OpenNone
OpenNone
Resolvedssastry
Resolvedssastry
Resolvedcscott
Resolvedcscott
Resolvedcscott
ResolvedNone
Resolvedssastry
Resolvedcscott
Resolvedcscott
Resolvedcscott
Resolvedcscott
ResolvedPRODUCTION ERRORLucas_Werkmeister_WMDE
ResolvedPRODUCTION ERRORabi_
ResolvedPRODUCTION ERRORcscott
ResolvedPRODUCTION ERRORroman-stolar
ResolvedNone
ResolvedNone
Resolvedmatmarex
Resolvedmatmarex
Resolvedcscott
Resolvedcscott
Resolvedcscott
Resolvedihurbain
ResolvedNone
OpenNone
ResolvedNone
Resolvedssastry
Declinedssastry
ResolvedPRODUCTION ERRORssastry
Resolvedcscott
Resolvedssastry
ResolvedMSantos
Resolvedihurbain
OpenNone
Resolvedcscott
DeclinedNone
DeclinedNone
DeclinedNone
DeclinedNone
Resolvedppelberg
ResolvedBUG REPORTNone
ResolvedPRODUCTION ERRORJdlrobson-WMF
ResolvedEsanders
OpenNone
OpenNone
OpenBUG REPORTNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
Resolvedcscott
Resolvedcscott
OpenNone
Resolvedmatmarex
ResolvedNone
Resolvedcscott
OpenNone
Resolvedcscott
ResolvedABreault-WMF
Resolvedcscott
Opencscott
Resolvedssastry
ResolvedJgiannelos
OpenJgiannelos
OpenJgiannelos
OpenJgiannelos
OpenJgiannelos
ResolvedJgiannelos

Event Timeline

From @Jdlrobson:

Probably best documentation we have is on wiki right now https://www.mediawiki.org/wiki/Manual:SkinMustache.php
but I’d love to have something better (that’s validating in CI) for documenting this as it’s effectively a stable API.

the legacy array in the serialization for back compat.

sounds great.

Note, if you want to drop/change the serialization in future, we'll need to coordinate regarding the template datsa specification we send to skins using Mustache. We have a plan for this, but haven't had a need to do it just yet!

Change 828104 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/services/parsoid@master] WIP: Declare a first-class object for section metadata

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

This use case may be useful to think about in the context of this one: T316007

Change 829083 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/core@master] Generate/set/get SectionMetaData objects instead of arrays

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

Change 828104 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Declare a first-class object for section metadata

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

Change 837692 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.17.0-a2

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

Change 837692 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.17.0-a2

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

Test wiki on Patch demo by Matma Rex using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/1ca3d80c4b/w/

Change 829083 merged by jenkins-bot:

[mediawiki/core@master] Generate/set/get TOCData/SectionMetadata objects instead of arrays

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

matmarex subscribed.

Looks like this is complete.

Test wiki on Patch demo by Matma Rex using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/637dfdccca/w/