Zod .describe() causing issues with schema validation
I'm seeing the following when running
The code in that file looks like this:
This is put into a table like so:
where
When i remove the describe lines I don't see the same error so I'm wondering if
npx convex devnpx convex dev✖ Error: Unable to run schema validation on https://sensible-salmon-524.convex.cloud
[CONVEX] Error fetching POST https://sensible-salmon-524.convex.cloud/api/prepare_schema 400 Bad Request: Error: Hit an error while evaluating your schema:
[CONVEX] Uncaught TypeError: Cannot read properties of undefined (reading 'describe')
[CONVEX] at <anonymous> (../types/fireview/filters/zod.ts:62:12)✖ Error: Unable to run schema validation on https://sensible-salmon-524.convex.cloud
[CONVEX] Error fetching POST https://sensible-salmon-524.convex.cloud/api/prepare_schema 400 Bad Request: Error: Hit an error while evaluating your schema:
[CONVEX] Uncaught TypeError: Cannot read properties of undefined (reading 'describe')
[CONVEX] at <anonymous> (../types/fireview/filters/zod.ts:62:12)The code in that file looks like this:
export const zFireviewWhereFilter = z.object({
value: z.union([
z
.object({
type: z.literal("static"),
value: z
.any()
.describe(
"The static value to filter on. This should match the type of the field."
),
})
.describe("A filter value that is a static value"),
z
.object({
type: z.literal("dynamic"),
queryValue: z.union([
zDocumentFieldFromPathQuery.describe(
"Used when the dynamic value is a field from a document."
),
zFirstNDocumentFieldsQuery.describe(
"Used when the dynamic value is a list of fields from several documents."
),
zDocumentFieldAggregationQuery.describe(
"Used when the dynamic value is an aggregation of a field."
),
]),
})
),
]),
});export const zFireviewWhereFilter = z.object({
value: z.union([
z
.object({
type: z.literal("static"),
value: z
.any()
.describe(
"The static value to filter on. This should match the type of the field."
),
})
.describe("A filter value that is a static value"),
z
.object({
type: z.literal("dynamic"),
queryValue: z.union([
zDocumentFieldFromPathQuery.describe(
"Used when the dynamic value is a field from a document."
),
zFirstNDocumentFieldsQuery.describe(
"Used when the dynamic value is a list of fields from several documents."
),
zDocumentFieldAggregationQuery.describe(
"Used when the dynamic value is an aggregation of a field."
),
]),
})
),
]),
});This is put into a table like so:
v.object({
...vCommonFilterExpressionFields.fields,
...vFireviewWhereFilter.fields,
}) v.object({
...vCommonFilterExpressionFields.fields,
...vFireviewWhereFilter.fields,
})where
export const vFireviewWhereFilter = zodToConvex(zFireviewWhereFilter);export const vFireviewWhereFilter = zodToConvex(zFireviewWhereFilter);When i remove the describe lines I don't see the same error so I'm wondering if
zodToConvexzodToConvex is doing something weird