From f1b4d57883dea1a108983e92441cb65c9eadfafb Mon Sep 17 00:00:00 2001 From: barshan23 Date: Wed, 16 Jul 2025 15:50:45 +0530 Subject: [PATCH 1/3] Removed lorem ipsum text generation --- assets/json-schema-faker.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/assets/json-schema-faker.js b/assets/json-schema-faker.js index 371ce71af..f0e264a63 100644 --- a/assets/json-schema-faker.js +++ b/assets/json-schema-faker.js @@ -24261,11 +24261,7 @@ function extend() { return generated > 0 ? Math.floor(generated) : Math.ceil(generated); }; - var LIPSUM_WORDS = ('Lorem ipsum dolor sit amet consectetur adipisicing elit sed do eiusmod tempor incididunt ut labore' - + ' et dolore magna aliqua Ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea' - + ' commodo consequat Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla' - + ' pariatur Excepteur sint occaecat cupidatat non proident sunt in culpa qui officia deserunt mollit anim id est' - + ' laborum').split(' '); + var LIPSUM_WORDS = ('string').split(' '); /** * Generates randomized array of single lorem ipsum words. * @@ -24452,6 +24448,8 @@ function extend() { minProps = Math.max(optionalsProbability === null || additionalProperties ? random.number(fillProps ? 1 : 0, max) : 0, min); } + let postFix = 0; + while (fillProps) { if (!(patternPropertyKeys.length || allowsAdditional)) { break; @@ -24490,7 +24488,7 @@ function extend() { current += 1; } } else { - const word = get(requiredProperties) || (wordsGenerator(1) + hash()); + const word = get(requiredProperties) || ('key_' + postFix++); if (!props[word]) { props[word] = additionalProperties || anyType; From 491cc8d326fdd3446f9bc911526a11ba144a0d4a Mon Sep 17 00:00:00 2001 From: barshan23 Date: Fri, 18 Jul 2025 16:51:27 +0530 Subject: [PATCH 2/3] Removed negative numbers --- assets/json-schema-faker.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/json-schema-faker.js b/assets/json-schema-faker.js index f0e264a63..c08d5f9d4 100644 --- a/assets/json-schema-faker.js +++ b/assets/json-schema-faker.js @@ -23620,9 +23620,9 @@ function extend() { var ALL_TYPES = ['array', 'object', 'integer', 'number', 'string', 'boolean', 'null']; var MOST_NEAR_DATETIME = 2524608000000; - var MIN_INTEGER = -100000000; - var MAX_INTEGER = 100000000; - var MIN_NUMBER = -100; + var MIN_INTEGER = 0; + var MAX_INTEGER = 10000; + var MIN_NUMBER = 0; var MAX_NUMBER = 100; var env = { ALL_TYPES: ALL_TYPES, From 9673925616d557f81b5f6677f4bfaff6b464b48c Mon Sep 17 00:00:00 2001 From: barshan23 Date: Mon, 21 Jul 2025 17:17:01 +0530 Subject: [PATCH 3/3] Added jsdoc to explain the changes --- assets/json-schema-faker.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/assets/json-schema-faker.js b/assets/json-schema-faker.js index c08d5f9d4..58a990943 100644 --- a/assets/json-schema-faker.js +++ b/assets/json-schema-faker.js @@ -24261,16 +24261,15 @@ function extend() { return generated > 0 ? Math.floor(generated) : Math.ceil(generated); }; - var LIPSUM_WORDS = ('string').split(' '); /** - * Generates randomized array of single lorem ipsum words. + * This will always return "string" as a value instead of Lorem text. + * It is used to generate a value for the "string" type. * * @param length * @returns {Array.} */ function wordsGenerator(length) { - var words = random.shuffle(LIPSUM_WORDS); - return words.slice(0, length); + return ['string']; } // fallback generator @@ -24448,7 +24447,7 @@ function extend() { minProps = Math.max(optionalsProbability === null || additionalProperties ? random.number(fillProps ? 1 : 0, max) : 0, min); } - let postFix = 0; + let propertyCount = 0; while (fillProps) { if (!(patternPropertyKeys.length || allowsAdditional)) { @@ -24488,7 +24487,13 @@ function extend() { current += 1; } } else { - const word = get(requiredProperties) || ('key_' + postFix++); + /* + This will generate a key_0, key_1, etc. for any additional properties, instead of + using a random word. This is to ensure that the generated keys are predictable and + consistent across generations. + */ + const PREFIX_KEY = 'key_' + const word = get(requiredProperties) || (PREFIX_KEY + propertyCount++); if (!props[word]) { props[word] = additionalProperties || anyType;