From 64c62a1847969485eefed961ece5828118b2a6ed Mon Sep 17 00:00:00 2001 From: Mohammad Kermani Date: Tue, 18 Apr 2023 14:17:36 +0330 Subject: [PATCH] fix(core): use `bigint` for `int64` types (#829) 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`. --- packages/core/src/getters/scalar.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/getters/scalar.ts b/packages/core/src/getters/scalar.ts index a7a8d1f56..38585af37 100644 --- a/packages/core/src/getters/scalar.ts +++ b/packages/core/src/getters/scalar.ts @@ -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) {