Problem
fetchAllItems (src/client/client.ts) only extracts items from an enveloped response when a pagination scheme applies:
const itemsField = locateItemsField(responseSchema, scheme);
// ...
const { body, headers } = await requestJsonWithHeaders(url);
const pageItems = itemsField ? body[itemsField] : undefined;
if (Array.isArray(pageItems)) {
items.push(...(pageItems as Record<string, unknown>[]));
}
When the response body is a top-level array ([ {...}, {...} ]), the 200 response schema is type: array, so locateItemsField returns undefined (it only inspects object properties / common envelope field names). itemsField is therefore undefined, pageItems is undefined, and nothing is pushed — the paginated walk visits every page but collects zero items.
The non-paginated path already handles this case:
const items = Array.isArray(body)
? (body as Record<string, unknown>[])
: extractItemsFromEnvelope(body, responseSchema);
but the paginated path has no equivalent bare-array fallback.
Why it matters here
This is the common shape for GitHub REST list endpoints: GET /repos/{owner}/{repo}/issues and GET /repos/{owner}/{repo}/issues/{issue_number}/comments both return a bare JSON array and paginate via the Link header. The existing GitHub nextLink pagination scheme (github.com/api.github.com/1.1.4/pagination-overlay.yaml in localthought/overlays) auto-detects on the Link header, so these lists go through fetchAllItems — and today come back empty. Reflector can't list issues or comments to reflect them (localthought/reflector#23, #25, #28) until this is fixed.
Request
In fetchAllItems, when the page body is an array, treat the body itself as the page's items (mirroring fetchCollectionSnapshot):
const pageItems = Array.isArray(body)
? body
: itemsField
? body[itemsField]
: undefined;
Acceptance
- A paginated GET whose body is a top-level array (with a
Link-header nextLink scheme) collects items across all pages.
- Enveloped responses are unchanged.
- Test covering a multi-page bare-array response.
Problem
fetchAllItems(src/client/client.ts) only extracts items from an enveloped response when a pagination scheme applies:When the response body is a top-level array (
[ {...}, {...} ]), the 200 response schema istype: array, solocateItemsFieldreturnsundefined(it only inspects object properties / common envelope field names).itemsFieldis thereforeundefined,pageItemsisundefined, and nothing is pushed — the paginated walk visits every page but collects zero items.The non-paginated path already handles this case:
but the paginated path has no equivalent bare-array fallback.
Why it matters here
This is the common shape for GitHub REST list endpoints:
GET /repos/{owner}/{repo}/issuesandGET /repos/{owner}/{repo}/issues/{issue_number}/commentsboth return a bare JSON array and paginate via theLinkheader. The existing GitHubnextLinkpagination scheme (github.com/api.github.com/1.1.4/pagination-overlay.yamlin localthought/overlays) auto-detects on theLinkheader, so these lists go throughfetchAllItems— and today come back empty. Reflector can't list issues or comments to reflect them (localthought/reflector#23, #25, #28) until this is fixed.Request
In
fetchAllItems, when the page body is an array, treat the body itself as the page's items (mirroringfetchCollectionSnapshot):Acceptance
Link-headernextLinkscheme) collects items across all pages.