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 @@ -362,9 +362,15 @@ function generateSampleData({
362362export function createUploadTemplateCSV ( instrument : AnyUnilingualFormInstrument ) {
363363 // TODO - type validationSchema as object
364364 const instrumentSchema = instrument . validationSchema as z . AnyZodObject ;
365- const shape = instrumentSchema . shape as { [ key : string ] : z . ZodTypeAny } ;
366365
367- const columnNames = Object . keys ( instrumentSchema . shape as z . AnyZodObject ) ;
366+ let shape : { [ key : string ] : z . ZodTypeAny } = { } ;
367+ if ( ( instrumentSchema . _def . typeName as string ) === 'ZodEffects' ) {
368+ shape = instrumentSchema . _def . schema . _def . shape ( ) as { [ key : string ] : z . ZodTypeAny } ;
369+ } else {
370+ shape = instrumentSchema . shape as { [ key : string ] : z . ZodTypeAny } ;
371+ }
372+
373+ const columnNames = Object . keys ( shape ) ;
368374
369375 const csvColumns = INTERNAL_HEADERS . concat ( columnNames ) ;
370376
You can’t perform that action at this time.
0 commit comments