@@ -12,6 +12,87 @@ export const ExcelGeneratorResponseSchema = z.object({
1212} ) ;
1313
1414// Request Body Schema
15- export const ExcelGeneratorRequestBodySchema = z . object ( { } ) ;
15+ export const ExcelGeneratorRequestBodySchema = z
16+ . object ( {
17+ sheetsData : z
18+ . array (
19+ z . object ( {
20+ sheetName : z . string ( ) . openapi ( {
21+ description : 'The name of the sheet to be created in the Excel file.' ,
22+ } ) ,
23+ tables : z
24+ . array (
25+ z . object ( {
26+ title : z . string ( ) . optional ( ) . openapi ( {
27+ description : 'The title of the table, which will be displayed in the first row.' ,
28+ } ) ,
29+ startCell : z . string ( ) . openapi ( {
30+ description : "The starting cell (e.g., 'A1') where the table will begin." ,
31+ } ) ,
32+ columns : z
33+ . array (
34+ z . object ( {
35+ name : z . string ( ) . openapi ( {
36+ description : 'The name of the column.' ,
37+ } ) ,
38+ type : z . enum ( [ 'string' , 'number' , 'boolean' , 'percent' , 'currency' , 'date' ] ) . openapi ( {
39+ description : 'The data type of the column.' ,
40+ } ) ,
41+ format : z . string ( ) . optional ( ) . openapi ( {
42+ description : "The format of the column (e.g., '0.00%', '$#,##0', etc.)." ,
43+ } ) ,
44+ } )
45+ )
46+ . openapi ( {
47+ description : 'The list of columns in the table, each with a name, type, and optional format.' ,
48+ } ) ,
49+ rows : z
50+ . array (
51+ z . array (
52+ z . object ( {
53+ type : z . enum ( [ 'static_value' , 'formula' ] ) . openapi ( {
54+ description : 'Indicates whether the cell contains a static value or a formula.' ,
55+ } ) ,
56+ value : z . string ( ) . openapi ( {
57+ description : 'The actual value or formula for the cell.' ,
58+ } ) ,
59+ } )
60+ )
61+ )
62+ . openapi ( {
63+ description : 'Array of rows in the table, where each row is an array of cells.' ,
64+ } ) ,
65+ skipHeader : z . boolean ( ) . optional ( ) . openapi ( {
66+ description : 'Whether to skip the header row for this table.' ,
67+ } ) ,
68+ } )
69+ )
70+ . openapi ( {
71+ description : 'The tables to include in the sheet.' ,
72+ } ) ,
73+ } )
74+ )
75+ . openapi ( {
76+ description : 'An array of sheet data, where each sheet contains a name and an array of tables to generate.' ,
77+ } ) ,
78+ excelConfigs : z
79+ . object ( {
80+ fontFamily : z . string ( ) . optional ( ) ,
81+ fontSize : z . number ( ) . optional ( ) ,
82+ headerFontSize : z . number ( ) . optional ( ) ,
83+ tableTitleFontSize : z . number ( ) . optional ( ) ,
84+ borderStyle : z . enum ( [ 'none' , 'thin' , 'double' , 'dashed' , 'thick' ] ) . optional ( ) ,
85+ autoFitColumnWidth : z . boolean ( ) . optional ( ) ,
86+ autoFilter : z . boolean ( ) . optional ( ) ,
87+ wrapText : z . boolean ( ) . optional ( ) ,
88+ } )
89+ . optional ( )
90+ . openapi ( {
91+ description : 'Configuration for the Excel file.' ,
92+ } ) ,
93+ } )
94+ . openapi ( {
95+ description : 'Request body for generating an Excel file.' ,
96+ } ) ;
1697
1798export type ExcelGeneratorRequestBody = z . infer < typeof ExcelGeneratorRequestBodySchema > ;
0 commit comments