question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

APIs explorer with pagination

See original GitHub issue

Feature Suggestion

Add pagination that is supported by catalog-backend to api-docs plugin.

Possible Implementation

Extend api-docs components and catalog-client to support pagination.

Context

At Zalando, we would like to add api-docs plugin to our system. The absence of pagination prevents us to introduce it since we are having >1k APIs. If there is no ongoing work or if it would be useful to other people, I would be happy to contribute to it.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
frebencommented, Jul 17, 2021

I want to explore a model where columns and filters explicitly ask for the fields that they want. That way the surrounding context can choose to fetch exactly the necessary fields (the union of all requested) and no more.

1reaction
kuangpcommented, Jul 16, 2021

FYI for others, I’m using the following workaround to override the catalogApiRef on my Backstage instance to strip out loading API definitions in the explorer view:

export class CatalogClientExt extends CatalogClientWrapper {
  async getEntities(
    request?: CatalogEntitiesRequest,
    options?: CatalogRequestOptions,
  ): Promise<CatalogListResponse<Entity>> {
    const filter = [request?.filter].flat().filter(Boolean);
    if (request && !request.fields && filter.length === 1 && filter[0]?.kind === 'api') {
      request.fields = [
        'apiVersion',
        'kind',
        'metadata',
        'relations',
        'status',
        'spec.lifecycle',
        'spec.owner',
        'spec.type',
        'spec.system',
      ];
    }
    return super.getEntities(request, options);
  }
}
// app/src/apis.ts
...
  createApiFactory({
    api: catalogApiRef,
    deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },
    factory: ({ discoveryApi, identityApi }) =>
      new CatalogClientExt({
        client: new CatalogClient({ discoveryApi }),
        identityApi,
      }),
  }),
...

This extends the default catalog client to modify the request made by the API explorer page. I also put up this PR to export CatalogClientWrapper in order to inherit from it (I’ve forked the class for the time being). Hopefully this also helps others for now.

I think the attachment store and actual support for pagination is the most appropriate solution here for optimizing load times.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Implementation: Pagination | YouTube Data API
Implementation: Pagination ... The following example shows how to retrieve additional sets of results for YouTube Data API (v3) queries. The API ......
Read more >
Paginated Results - Graph API - Meta for Developers
Paginated Results. We cover the basics of Graph API terminology and structure in the Graph API overview. This document goes into more detail...
Read more >
Pagination for API output - New Relic Documentation
Pagination is no longer available for metrics output for some customers ... In the REST API Explorer, you can quickly change the page...
Read more >
Any way to have a pagination or search query for the dynamic ...
I found out you can use parameters with api here https://developers.google.com/fonts/docs/developer_api. If you only want families (font ...
Read more >
Pagination on Search/Collection APIs : Knowledge Base
Pagination on Search/Collection APIs. Depending on your organization's usage profile, our API provides access to potentially large numbers of records.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found