CCC
Convex Community12mo ago
23 replies
CC

Validation of (partial) Convex-schemas

I have a use-case where it would be super helpful to be able to call something like:
const schema = v.object({
   "name": v.string()
});

const input = schema.parse(input);

...similar to the "zod"-functionality parse/safeParse. The reasoning for this is that I will be validating partial data returned from an LLM that will fit into a Convex-schema, and I don't want to maintain two schemas.

My problem is that I cannot find the parse/safeParse-methods anywhere, but they "must be there" (right?), as the data is indeed parsed/validated by Convex at some point.

Thanks to @ian for the help so far.
Was this page helpful?