oracle / oracle/oci-python-sdk

Pagination does not work for `identity_domains_client.list_groups` if attributes are added

Open
#708 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

SDK
Dominant language
Python
Stars
474
Forks
321
Avg merge
23m
Merged PRs (30d)
4

Description

The below code attempts to list all groups in an identity domain. However, adding either attribute_sets or attributes will cause the response to indicate has_next_page == True and next_page to have a value even if the results are already complete.

import oci

config = oci.config.from_file("~/.oci/config", "DEFAULT")
tenancy_ocid = config["tenancy"]

# Get the domain endpoint
identity_client = oci.identity.IdentityClient(config)
list_domains_response = identity_client.list_domains(tenancy_ocid)
domain01_endpoint = list_domains_response.data[0].url

# Get the groups
identity_domains_client = oci.identity_domains.IdentityDomainsClient(
    config, domain01_endpoint
)
list_groups_response = identity_domains_client.list_groups(
    # BUG: adding attribute_sets or attributes causes the `has_next_page` to be true
    attribute_sets=["request"],
    attributes="members,ocid",
)
print(list_groups_response.has_next_page)
# outputs True even if the response is already complete and no more pages are expected

Versions

  • oci==2.131.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the example with IdentityDomainsClient.list_groups using attribute_sets and attributes, then inspect how its response determines has_next_page and next_page. Done means a complete response no longer reports another page when those attributes are supplied, with coverage for the reported oci==2.131.0 case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.