@@ -327,7 +327,7 @@ function renderDocumentCode(
327327
328328 const fieldIndent = ' ' . repeat ( indent ) ;
329329 const closingBraceIndent = ' ' . repeat ( indent - INDENT_SIZE ) ;
330- const rootLevelFields : string [ ] = [ ] ;
330+ const documentFields : string [ ] = [ ] ;
331331
332332 for ( const [ fieldName , value ] of Object . entries ( structure ) ) {
333333 if ( 'mongoType' in value ) {
@@ -347,12 +347,12 @@ function renderDocumentCode(
347347
348348 if ( probability < 1.0 ) {
349349 // Use Math.random for conditional field inclusion
350- rootLevelFields . push (
350+ documentFields . push (
351351 `${ fieldIndent } ...(Math.random() < ${ probability } ? { ${ fieldName } : ${ fakerCall } } : {})`
352352 ) ;
353353 } else {
354354 // Normal field inclusion
355- rootLevelFields . push ( `${ fieldIndent } ${ fieldName } : ${ fakerCall } ` ) ;
355+ documentFields . push ( `${ fieldIndent } ${ fieldName } : ${ fakerCall } ` ) ;
356356 }
357357 } else if ( 'type' in value && value . type === 'array' ) {
358358 // It's an array
@@ -363,7 +363,7 @@ function renderDocumentCode(
363363 arrayLengthMap ,
364364 0 // Start at dimension 0
365365 ) ;
366- rootLevelFields . push ( `${ fieldIndent } ${ fieldName } : ${ arrayCode } ` ) ;
366+ documentFields . push ( `${ fieldIndent } ${ fieldName } : ${ arrayCode } ` ) ;
367367 } else {
368368 // It's a nested object: recursive call
369369
@@ -380,16 +380,16 @@ function renderDocumentCode(
380380 indent + INDENT_SIZE ,
381381 nestedArrayLengthMap
382382 ) ;
383- rootLevelFields . push ( `${ fieldIndent } ${ fieldName } : ${ nestedCode } ` ) ;
383+ documentFields . push ( `${ fieldIndent } ${ fieldName } : ${ nestedCode } ` ) ;
384384 }
385385 }
386386
387387 // Handle empty objects
388- if ( rootLevelFields . length === 0 ) {
388+ if ( documentFields . length === 0 ) {
389389 return '{}' ;
390390 }
391391
392- return `{\n${ rootLevelFields . join ( ',\n' ) } \n${ closingBraceIndent } }` ;
392+ return `{\n${ documentFields . join ( ',\n' ) } \n${ closingBraceIndent } }` ;
393393}
394394
395395/**
0 commit comments