Skip to content

Commit

Permalink
fix(core): use bigint for int64 types (#829)
Browse files Browse the repository at this point in the history
There are two types of integers supported in OpenAPI spec: `int32` and
`int64`. The current version of `orval`, however, converts all those
integers to js `number` and doesn't consider `int64` types as `bigint`.

Check the type of the integer and use `bigint` instead of `number` if
it is an `int64`.
  • Loading branch information
mkermani144 authored Apr 18, 2023
1 parent 94e2c8e commit 64c62a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/getters/scalar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const getScalar = ({
switch (item.type) {
case 'number':
case 'integer': {
let value = 'number';
let value = item.format === 'int64' ? 'bigint' : 'number';
let isEnum = false;

if (item.enum) {
Expand Down

1 comment on commit 64c62a1

@vercel
Copy link

@vercel vercel bot commented on 64c62a1 Apr 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.