octokit / plugin-paginate-rest.js

Octokit plugin to paginate REST API endpoint responses
MIT License
46 stars 23 forks source link

[BUG]: response incorrectly normalized: namespace key replaced with indexed keys #560

Open erikbrgn opened 1 year ago

erikbrgn commented 1 year ago

What happened?

Using the provided iterator function for the octokit.rest.repos.getAllEnvironments endpoint results in a normalized response where the environments key under response.data is replaced by the environments keyed by their index. This causes the response object to no longer match the response type.

I expected the response to not need normalization and simply return just like the typehinting was telling me.

Versions

Octokit/rest v20.0.1, Deno v1.36.4

Relevant log output

No response

Code of Conduct

github-actions[bot] commented 1 year ago

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

larbish commented 11 months ago

I'm facing the same issue

gr2m commented 11 months ago

if anyone wants to debug why it's not normalizing the response correctly, the code is here: https://github.com/octokit/plugin-paginate-rest.js/blob/main/src/normalize-paginated-list-response.ts