Skip to content

Requesting a subset of fields inadvertently strips paging metadata #91

Open
@AlexHowansky

Description

@AlexHowansky

This issue stems from a quirk of the API which can be worked around rather simply. As a result, this probably shouldn't be considered a bug, but a feature request.

If I request a subset of available fields via the fields parameter, and I do not include the pagination fields in my list, then the API will not return the pagination metadata, and I will be unable to retrieve the full data set.

For example, if I do the following, everything works great:

$tagsRequest = $client->repositories()->workspaces($workspace)->refs($repo)->tags();
$tags = $pager->fetchAll($tagsRequest, 'list');
// $tags includes all records

However, if I change the request to only include a specific field, I only get the first page, with no obvious indication that will happen, and no warning or error issued:

$tagsRequest = $client->repositories()->workspaces($workspace)->refs($repo)->tags();
$tags = $pager->fetchAll($tagsRequest, 'list', ['params' => ['fields' => 'values.name']]);
// $tags includes only records on the first page

I propose a change to ensure that if fields is provided and not empty, then it should be validated (and probably amended) to include the fields that pagination relies on (size, page, pagelen, next, previous) so that we don't accidentally and silently lose records.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions