Page MenuHomePhabricator

wikitext/to/lint API is returning an empty array for night-mode-unaware-background-color lint errors
Open, MediumPublic

Description

When I use the https://en.wikipedia.org/api/rest_v1/transform/wikitext/to/lint API, I see, e.g.:

Object {
    "dsr": Array [
        Number(150414),
        Number(150421),
        Null,
        Null,
    ],
    "params": Object {
        "name": String("font"),
    },
    "templateInfo": Null,
    "type": String("stripped-tag"),
},
Object {
    "dsr": Array [
        Number(154384),
        Number(156793),
        Null,
        Null,
    ],
    "params": Array [],
    "templateInfo": Object {
        "multiPartTemplateBlock": Bool(true),
    },
    "type": String("night-mode-unaware-background-color"),
},

Note that in one case, it's a JSON object, i.e. {}, and in another it's an array, []. As far as I can tell, the night mode lint is the only one with an array. We probably just need to cast the empty array to an object first.

Event Timeline

Change #1057043 had a related patch set uploaded (by Legoktm; author: Legoktm):

[mediawiki/services/parsoid@master] Ensure that empty lint errors `params` field is a JSON object

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

Change #1057043 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Ensure that empty lint errors `params` field is a JSON object

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

ABreault-WMF triaged this task as Medium priority.
ABreault-WMF moved this task from Backlog to To Deploy on the Content-Transform-Team-WIP board.

Change #1057922 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.20.0-a15

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

Change #1057922 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.20.0-a15

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

This was reverted as part of T371376: Linter related error on PCS tests: Cannot use object of type stdClass as array, the Linter extension was expecting it to be an array so need to rethink how to implement this.