-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetRowsOptions Type Error for startIndex: Expects a string when it should expect a number #1350
Comments
Copying the comments from PR #1351
So in summary, it still makes sense to accept a string here because of the format, if we support |
@alvarowolfx Oh I see. Seems like a mistake to me, especially because maxResults, though similar but oddly uint32, is defined as an integer. From "maxResults":
{
"description": "Maximum number of results to read.",
"format": "uint32",
"location": "query",
"type": "integer"
}, On the Typescript side, would you agree it seems like a bug to have to adapt an integer index to be a string in order to pass through? Obviously this is beyond an issue with this module, but not sure where the relevant upstream issue should be tracked. |
the key difference is the |
@alvarowolfx Got it, reading https://developers.google.com/discovery/v1/type-format a bit more and I see the reason why Uint64 is a string more clearly. Though from a TypeScript standpoint still seems strange, as I could pass a string But to continue the discussion, when not using TypeScript, the module already works by passing in a literal integer. Typescript can be very adaptable to support integers AND strings as a type definition. I would propose the issue is actually on the upstream https://github.com/callmehiphop/discovery-tsd/blob/master/src/converter.js Personally for Typescript, I would convert the following schema to a
So I could propose in a PR on https://github.com/callmehiphop/discovery-tsd Some background on my end, this issue arose when converting an existing project to use Typescript, and I was surprised by the definition. |
Accepts both string and number when the API expects uint64 or int64. This solution allows regular JS integers (2^53-1) but can also take a string for larger numbers if needed. See googleapis/nodejs-bigquery#1350 for specific discussion on issue.
Environment details
@google-cloud/bigquery
version: 7.5.2Steps to reproduce
startIndex
as an integer option togetRows
. eg.table.getRows({ startIndex: 31241 })
.Expected behaviour
startIndex
should work with an integer. As it is right now I need to convert the integer to a string eg.31241.toString()
Relevant fixes in the code
nodejs-bigquery/src/types.d.ts
Line 5903 in 74aa150
nodejs-bigquery/src/types.d.ts
Line 6055 in 74aa150
The text was updated successfully, but these errors were encountered: