Skip to content

Commit

Permalink
Support passing in literal numbers on uint64 and int64 types
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
arjunmehta authored Apr 3, 2024
1 parent 3897ca2 commit 9903c70
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class Converter {
if (schema.type === 'integer') {
return 'number';
}
if (schema.type === 'string' && (schema.format === 'uint64' || schema.format === 'int64')) {
return 'number | string';
}
if (schema.type === 'array') {
return this.toArray(schema.items, schema.additionalItems);
}
Expand Down

0 comments on commit 9903c70

Please sign in to comment.