diff --git a/packages/lib/plugin-connector/src/data-sources/schemas/query-runner.schema.js b/packages/lib/plugin-connector/src/data-sources/schemas/query-runner.schema.js index 9a86f131b2..72637c1722 100644 --- a/packages/lib/plugin-connector/src/data-sources/schemas/query-runner.schema.js +++ b/packages/lib/plugin-connector/src/data-sources/schemas/query-runner.schema.js @@ -24,13 +24,21 @@ export const QueryResultSchema = z // inconsistent array (e.g. [{}, 1]), it will not detect the // invalid row. rows: QueryResultArraySchema.or(QueryResultGeneratorSchema), - columnTypes: z.array( - z.object({ - name: z.string(), - evidenceType: z.enum(['boolean', 'number', 'string', 'date']), - typeFidelity: z.union([z.literal('precise'), z.literal('inferred')]) + columnTypes: z + .any() + .refine((arg) => { + console.log('QueryResultSchema.columnTypes', { arg }); + return arg; }) - ), + .pipe( + z.array( + z.object({ + name: z.string(), + evidenceType: z.enum(['boolean', 'number', 'string', 'date']), + typeFidelity: z.union([z.literal('precise'), z.literal('inferred')]) + }) + ) + ), expectedRowCount: z.number().optional() }) .refine( diff --git a/packages/lib/sdk/src/plugins/datasources/schemas/results.schema.js b/packages/lib/sdk/src/plugins/datasources/schemas/results.schema.js index 447022a23a..fe20790f7b 100644 --- a/packages/lib/sdk/src/plugins/datasources/schemas/results.schema.js +++ b/packages/lib/sdk/src/plugins/datasources/schemas/results.schema.js @@ -17,13 +17,21 @@ const QueryResultArraySchema = z.any().refine( const QueryResultGeneratorSchema = z.function(); const QueryResultMetaSchema = z.object({ - columnTypes: z.array( - z.object({ - name: z.string(), - evidenceType: z.enum(['boolean', 'number', 'string', 'date']), - typeFidelity: z.union([z.literal('precise'), z.literal('inferred')]) + columnTypes: z + .any() + .refine((arg) => { + console.log('QueryResultMetaSchema.columnTypes', { arg }); + return arg; }) - ), + .pipe( + z.array( + z.object({ + name: z.string(), + evidenceType: z.enum(['boolean', 'number', 'string', 'date']), + typeFidelity: z.union([z.literal('precise'), z.literal('inferred')]) + }) + ) + ), expectedRowCount: z.number().optional() });