nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: json-schema-faker/json-schema-faker
Pull request #836 (2025-01-02 15:38:03)

dev sync
I want to make another release, but we still have some issues, I'll try to handle them in the upcoming weeks. If you want to collaborate just create a PR against this branch, thank you everyone and happy new year! :tada:


Patch:
diff --git a/package.json b/package.json
index a85e4ac..be7c2dc 100644
--- a/package.json
+++ b/package.json
@@ -96,11 +96,12 @@
   ],
   "files": [
     "dist/*.*",
-    "index.d.ts"
+    "index.d.ts",
+    "index.d.cts"
   ],
   "dependencies": {
     "json-schema-ref-parser": "^6.1.0",
-    "jsonpath-plus": "^10.1.0"
+    "jsonpath-plus": "^10.3.0"
   },
   "devDependencies": {
     "@faker-js/faker": "^7.6.0",
diff --git a/src/lib/types/number.mjs b/src/lib/types/number.mjs
index 4ee101e..cca0881 100644
--- a/src/lib/types/number.mjs
+++ b/src/lib/types/number.mjs
@@ -2,8 +2,16 @@ import random from '../core/random.mjs';
 import env from '../core/constants.mjs';
 
 function numberType(value) {
-  let min = (typeof value.minimum === 'undefined' || value.minimum === -Number.MAX_VALUE) ? env.MIN_INTEGER : value.minimum;
-  let max = (typeof value.maximum === 'undefined' || value.maximum === Number.MAX_VALUE) ? env.MAX_INTEGER : value.maximum;
+  let min = (typeof value.minimum === 'undefined' || value.minimum === -Number.MAX_VALUE)
+    ? env.MIN_INTEGER
+    : value.minimum;
+  let max = (typeof value.maximum === 'undefined' || value.maximum === Number.MAX_VALUE)
+    ? env.MAX_INTEGER
+    : value.maximum;
+
+  if (min > max) {
+    max = Number.MAX_SAFE_INTEGER;
+  }
 
   const multipleOf = value.multipleOf;
   const decimals = multipleOf && String(multipleOf).match(/e-(\d)|\.(\d+)$/);


Test patch:
diff --git a/tests/unit/generators/number.spec.mjs b/tests/unit/generators/number.spec.mjs
index 3e2fe14..b7da9a7 100644
--- a/tests/unit/generators/number.spec.mjs
+++ b/tests/unit/generators/number.spec.mjs
@@ -14,6 +14,13 @@ describe('Number Generator', () => {
     expect(n).not.to.eql(m);
   });
 
+  it('should return number with large minimum without specified maximum', () => {
+    const n = numberType({ minimum: 1682899200000 });
+
+    expect(n).to.be.a('number');
+    expect(n).to.be.at.least(1682899200000);
+  });
+
   it('should handle multipleOf on integers', () => {
     expect(isMultipleOf({ multipleOf: 1 })).to.be.true;
     expect(isMultipleOf({ multipleOf: 1, maximum: 1e+31 })).to.be.true;