Skip to content
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

fix: change startIndex option type from string to number #1351

Closed
wants to merge 1 commit into from

Conversation

arjunmehta
Copy link

@arjunmehta arjunmehta commented Apr 2, 2024

startIndex should be an 0-indexed integer. But as it is was expecting a string which is incorrect and caused a lot of confusion, preventing compilation and requiring odd workarounds.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #1350 🙏

startIndex should be an 0-indexed integer. But as it is was expecting a string which is incorrect and caused a lot of confusion, preventing compilation and requiring odd workarounds.
@arjunmehta arjunmehta requested review from a team as code owners April 2, 2024 22:17
@arjunmehta arjunmehta requested a review from tswast April 2, 2024 22:17
Copy link

google-cla bot commented Apr 2, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: bigquery Issues related to the googleapis/nodejs-bigquery API. labels Apr 2, 2024
@arjunmehta arjunmehta changed the title Fix startIndex option type from string to number fix: startIndex option type from string to number Apr 2, 2024
Copy link

conventional-commit-lint-gcf bot commented Apr 2, 2024

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

@arjunmehta arjunmehta changed the title fix: startIndex option type from string to number fix: change startIndex option type from string to number Apr 2, 2024
@alvarowolfx
Copy link
Contributor

this file should not be manually modified, as it is generated from the Discovery doc (with the command npm run types).

@arjunmehta
Copy link
Author

@alvarowolfx Ah got it, I will close this PR then but the issue remains open. I am happy to contribute a solution, but not sure where to find/update the relevant Discovery Doc definition. If you want to point me to it I can attempt. Or someone who knows the procedure might be better suited to make the quick fix.

@arjunmehta arjunmehta closed this Apr 3, 2024
@alvarowolfx
Copy link
Contributor

@alvarowolfx Ah got it, I will close this PR then but the issue remains open. I am happy to contribute a solution, but not sure where to find/update the relevant Discovery Doc definition. If you want to point me to it I can attempt. Or someone who knows the procedure might be better suited to make the quick fix.

the Discovery document represents the backend/API definition, so it can only be changed by the service side itself. In this case, would be a change on the BigQuery backend.

What can be done is to change the generated code to take into consideration the format field of the Discovery doc, not just the type field. But in the end what the service side accepts is a string, so some conversion would have to happen.

@alvarowolfx
Copy link
Contributor

Another thing to consider is that the startIndex attribute expects an uint64 and that can't be represented with a integer in Javascript, which holds at most 2^53 - 1. So users would have to use a BigInt and convert to string anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/nodejs-bigquery API. size: xs Pull request size is extra small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GetRowsOptions Type Error for startIndex: Expects a string when it should expect a number
2 participants