Skip to content

Commit a42d094

Browse files
authored
Merge pull request #855 from postmanlabs/feature/remove-lorem-ipsum-text-generation
Updated fake data generation
2 parents 1a10d94 + 9673925 commit a42d094

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

assets/json-schema-faker.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23620,9 +23620,9 @@ function extend() {
2362023620

2362123621
var ALL_TYPES = ['array', 'object', 'integer', 'number', 'string', 'boolean', 'null'];
2362223622
var MOST_NEAR_DATETIME = 2524608000000;
23623-
var MIN_INTEGER = -100000000;
23624-
var MAX_INTEGER = 100000000;
23625-
var MIN_NUMBER = -100;
23623+
var MIN_INTEGER = 0;
23624+
var MAX_INTEGER = 10000;
23625+
var MIN_NUMBER = 0;
2362623626
var MAX_NUMBER = 100;
2362723627
var env = {
2362823628
ALL_TYPES: ALL_TYPES,
@@ -24261,20 +24261,15 @@ function extend() {
2426124261
return generated > 0 ? Math.floor(generated) : Math.ceil(generated);
2426224262
};
2426324263

24264-
var LIPSUM_WORDS = ('Lorem ipsum dolor sit amet consectetur adipisicing elit sed do eiusmod tempor incididunt ut labore'
24265-
+ ' et dolore magna aliqua Ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea'
24266-
+ ' commodo consequat Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla'
24267-
+ ' pariatur Excepteur sint occaecat cupidatat non proident sunt in culpa qui officia deserunt mollit anim id est'
24268-
+ ' laborum').split(' ');
2426924264
/**
24270-
* Generates randomized array of single lorem ipsum words.
24265+
* This will always return "string" as a value instead of Lorem text.
24266+
* It is used to generate a value for the "string" type.
2427124267
*
2427224268
* @param length
2427324269
* @returns {Array.<string>}
2427424270
*/
2427524271
function wordsGenerator(length) {
24276-
var words = random.shuffle(LIPSUM_WORDS);
24277-
return words.slice(0, length);
24272+
return ['string'];
2427824273
}
2427924274

2428024275
// fallback generator
@@ -24452,6 +24447,8 @@ function extend() {
2445224447
minProps = Math.max(optionalsProbability === null || additionalProperties ? random.number(fillProps ? 1 : 0, max) : 0, min);
2445324448
}
2445424449

24450+
let propertyCount = 0;
24451+
2445524452
while (fillProps) {
2445624453
if (!(patternPropertyKeys.length || allowsAdditional)) {
2445724454
break;
@@ -24490,7 +24487,13 @@ function extend() {
2449024487
current += 1;
2449124488
}
2449224489
} else {
24493-
const word = get(requiredProperties) || (wordsGenerator(1) + hash());
24490+
/*
24491+
This will generate a key_0, key_1, etc. for any additional properties, instead of
24492+
using a random word. This is to ensure that the generated keys are predictable and
24493+
consistent across generations.
24494+
*/
24495+
const PREFIX_KEY = 'key_'
24496+
const word = get(requiredProperties) || (PREFIX_KEY + propertyCount++);
2449424497

2449524498
if (!props[word]) {
2449624499
props[word] = additionalProperties || anyType;

0 commit comments

Comments
 (0)