Page MenuHomePhabricator

MenteesHandler returns different JSON structures for "mentees" data
Closed, ResolvedPublic

Description

If we compare the JSON response of these two requests to /mentees we can see how the mentees property is an Array whereas when the query parameter offset is higher than zero the returned structure is an array-like Object.

{
    "mentees": [
        {
            "username": "redacted_1",
            "user_id": "1"
            ...
        }
    ],
    "totalRows": 2,
    "limit": 1,
    "offset": 0
}
{
    "mentees": {
        "1": {
            "username": "redacted_2",
            "user_id": "2"
        }
    },
    "totalRows": 2,
    "limit": 1,
    "offset": 1
}

This is not ideal from an API output consistency point of view. It also leads API clients to have to treat differently similar responses.

Event Timeline

Change 757914 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/GrowthExperiments@master] Mentor dashboard: standarise JSON response in mentees handler

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

Sgs updated the task description. (Show Details)

Change 757914 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Mentor dashboard: standarise JSON response in mentees handler

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

Etonkovidova claimed this task.
Etonkovidova subscribed.

Tested on testwiki wmf.21 - offset=0 and offset=1 responses display the same format.