Skip to content
This repository was archived by the owner on Jul 20, 2023. It is now read-only.
This repository was archived by the owner on Jul 20, 2023. It is now read-only.

Respect pageSize parameter #296

@zettadam

Description

@zettadam

Environment details

  • OS: MacOS BigSur 11.5.1
  • Node.js version: 16.7.0
  • npm version: 7.20.3
  • @google-cloud/datacatalog version: 2.5.0

I wrote a request handler (fastify) that uses @google-cloud/datacatalog library. According to documentation I should pass pageSize to limit the number of results returned. However, responses to searchCatalog or searchCatalogAsync return hundreds or thousands of results when I pass pageSize parameter in the request body.

Seems like a bug? Or am I using this API incorrectly?

My request body is as follows:

{
	"query": "country",
	"pageSize": 50,
	"orderBy": "relevance"
}

My handler looks like this:

import { DataCatalogClient } from '@google-cloud/datacatalog'

const dc = new DataCatalogClient()
const projectId = 'some-project-id'

const search = async (req, res) => {
  const { body } = req
  const requestPayload = {
    scope: {
      includeProjectIds: [projectId],
    },
    ...body
  }
  
  const result = await dc.searchCatalogAsync(requestPayload)

  let results = []

  for await(const r of result) {
    results.push(r)
  }

  res.code(200).send(results)
}

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: datacatalogIssues related to the googleapis/nodejs-datacatalog API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions