diff --git a/package.json b/package.json index 28b1174..8815879 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "lodash.pickby": "^4.6.0", "openapi3-ts": "^2.0.2", "postman-collection": "^4.1.2", - "tslib": "^2.3.1", + "tslib": "^2.6.2", "type-is": "^1.6.18" }, "devDependencies": { diff --git a/src/oas/__tests__/__snapshots__/operation.test.ts.snap b/src/oas/__tests__/__snapshots__/operation.test.ts.snap index 7007f6d..65b62e2 100644 --- a/src/oas/__tests__/__snapshots__/operation.test.ts.snap +++ b/src/oas/__tests__/__snapshots__/operation.test.ts.snap @@ -29,8 +29,8 @@ Array [ }, "id": Object { "format": "int64", - "maximum": 9223372036854776000, - "minimum": -9223372036854776000, + "maximum": 9007199254740991, + "minimum": -9007199254740991, "type": "integer", "x-stoplight": Object { "explicitProperties": Array [ @@ -90,8 +90,8 @@ Array [ }, "id": Object { "format": "int64", - "maximum": 9223372036854776000, - "minimum": -9223372036854776000, + "maximum": 9007199254740991, + "minimum": -9007199254740991, "type": "integer", "x-stoplight": Object { "explicitProperties": Array [ @@ -349,8 +349,8 @@ Array [ "schema": Object { "$schema": "http://json-schema.org/draft-07/schema#", "format": "int64", - "maximum": 9223372036854776000, - "minimum": -9223372036854776000, + "maximum": 9007199254740991, + "minimum": -9007199254740991, "type": "number", "x-stoplight": Object { "explicitProperties": Array [ @@ -450,8 +450,8 @@ Array [ }, "id": Object { "format": "int64", - "maximum": 9223372036854776000, - "minimum": -9223372036854776000, + "maximum": 9007199254740991, + "minimum": -9007199254740991, "type": "integer", "x-stoplight": Object { "explicitProperties": Array [ @@ -511,8 +511,8 @@ Array [ }, "id": Object { "format": "int64", - "maximum": 9223372036854776000, - "minimum": -9223372036854776000, + "maximum": 9007199254740991, + "minimum": -9007199254740991, "type": "integer", "x-stoplight": Object { "explicitProperties": Array [ @@ -771,8 +771,8 @@ Array [ }, "id": Object { "format": "int64", - "maximum": 9223372036854776000, - "minimum": -9223372036854776000, + "maximum": 9007199254740991, + "minimum": -9007199254740991, "type": "integer", "x-stoplight": Object { "explicitProperties": Array [ @@ -833,8 +833,8 @@ Array [ }, "id": Object { "format": "int64", - "maximum": 9223372036854776000, - "minimum": -9223372036854776000, + "maximum": 9007199254740991, + "minimum": -9007199254740991, "type": "integer", "x-stoplight": Object { "explicitProperties": Array [ @@ -1069,8 +1069,8 @@ Array [ }, "id": Object { "format": "int64", - "maximum": 9223372036854776000, - "minimum": -9223372036854776000, + "maximum": 9007199254740991, + "minimum": -9007199254740991, "type": "integer", "x-stoplight": Object { "explicitProperties": Array [ @@ -1131,8 +1131,8 @@ Array [ }, "id": Object { "format": "int64", - "maximum": 9223372036854776000, - "minimum": -9223372036854776000, + "maximum": 9007199254740991, + "minimum": -9007199254740991, "type": "integer", "x-stoplight": Object { "explicitProperties": Array [ diff --git a/src/oas/transformers/schema/__tests__/schema.spec.ts b/src/oas/transformers/schema/__tests__/schema.spec.ts index 7c540e5..6916471 100644 --- a/src/oas/transformers/schema/__tests__/schema.spec.ts +++ b/src/oas/transformers/schema/__tests__/schema.spec.ts @@ -110,7 +110,7 @@ describe('translateSchemaObject', () => { { type: 'integer', format: 'int64', - maximum: 2 ** 40, + maximum: Number.MAX_SAFE_INTEGER, 'x-stoplight': { explicitProperties: ['type', 'format', 'maximum'], }, @@ -139,8 +139,8 @@ describe('translateSchemaObject', () => { { type: 'integer', format: 'int64', - minimum: 0 - 2 ** 63, - maximum: 2 ** 40, + minimum: Number.MIN_SAFE_INTEGER, + maximum: Number.MAX_SAFE_INTEGER, 'x-stoplight': { explicitProperties: ['type', 'format', 'maximum'], }, diff --git a/src/oas/transformers/schema/keywords/format.ts b/src/oas/transformers/schema/keywords/format.ts index efef8fb..64f9001 100644 --- a/src/oas/transformers/schema/keywords/format.ts +++ b/src/oas/transformers/schema/keywords/format.ts @@ -6,8 +6,8 @@ import type { Converter } from '../types'; const ranges = { MIN_INT_32: 0 - 2 ** 31, MAX_INT_32: 2 ** 31 - 1, - MIN_INT_64: 0 - 2 ** 63, - MAX_INT_64: 2 ** 63 - 1, + MIN_INT_64: Number.MIN_SAFE_INTEGER, + MAX_INT_64: Number.MAX_SAFE_INTEGER, MIN_FLOAT: 0 - 2 ** 128, MAX_FLOAT: 2 ** 128 - 1, MIN_DOUBLE: 0 - Number.MAX_VALUE, diff --git a/yarn.lock b/yarn.lock index 6b36af2..4fbced0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10373,6 +10373,11 @@ tslib@^2.0.0, tslib@^2.2.0, tslib@^2.3.1: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== +tslib@^2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" + integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== + tsutils@^3.21.0: version "3.21.0" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"