File tree Expand file tree Collapse file tree
apps/web/src/features/upload Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -335,15 +335,14 @@ function generateSampleData({
335335 return formatTypeInfo ( 'number' , isOptional ) ;
336336 case 'ZodSet' :
337337 try {
338- let possibleEnumOutputs = 'SET(' ;
339- for ( const val of enumValues ! ) {
340- possibleEnumOutputs += val + '/' ;
338+ if ( ! enumValues ) {
339+ throw new Error ( 'Missing enumValues for ZodSet' ) ;
341340 }
342- possibleEnumOutputs = possibleEnumOutputs . slice ( 0 , - 1 ) ;
343- possibleEnumOutputs += ' , ...)' ;
341+ const enumString = enumValues . join ( '/' ) ;
342+ const possibleEnumOutputs = `SET( ${ enumString } , ...)` ;
344343 return formatTypeInfo ( possibleEnumOutputs , isOptional ) ;
345- } catch {
346- throw new Error ( 'Invalid Enum error' ) ;
344+ } catch ( error ) {
345+ throw new Error ( `Failed to generate sample data for ZodSet: ${ error . message } ` ) ;
347346 }
348347
349348 case 'ZodString' :
You can’t perform that action at this time.
0 commit comments