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.

Incomplete ImprovedRequest TypeScript interface #963

@clorichel

Description

@clorichel

Environment details

  • OS: irrelevant
  • Node.js version: irrelevant
  • npm version: irrelevant
  • @google-cloud/vision version: 2.4.0

Steps to reproduce

const client = new vision.ImageAnnotatorClient();
const [result] = await client.cropHints({ image: { source: { filename } }, imageContext: {} });

Gives you an 'imageContext' does not exist in type 'ImprovedRequest | Buffer' TypeScript error.

Description

That might not be an issue only for the cropHints feature, but any ImageAnnotatorClient feature which method signature is equivalent/limited to (request: string | ImprovedRequest | Buffer).

The appropriate JSON representation is documented here: https://cloud.google.com/vision/docs/reference/rest/v1/AnnotateImageRequest where we can see that imageContext is possible, yet not in this package ImprovedRequest interface. Then one could drill it down to https://cloud.google.com/vision/docs/reference/rest/v1/ImageContext to actually provide a thorough interface.

Workaround

The request actually works fine if you simply cast the method parameter through client.cropHints({ image: { source: { filename } }, imageContext: {} } as any): the imageContext is passed down to the underlying service and used as one could expect to generate the response.

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: visionIssues related to the googleapis/nodejs-vision API.priority: p2Moderately-important priority. Fix may not be included in next release.triage meI really want to be triaged.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