generateVexSchema
generateVexSchema(
props):object
Defined in: packages/core/src/schema/generateVexSchema.ts:40
Generates the full contents of vex.schema.ts from a resolved VexConfig.
Returns { update: false, contents } when there are no collections — the output
contains only the auto-generated header and no imports or table declarations.
Returns { update: true, contents } when collections are present — the output
includes the header, convex/server and convex/values imports, and one
export const block per collection.
Parameters
Section titled “Parameters”Input props.
config
Section titled “config”The fully resolved Vex configuration.
Returns
Section titled “Returns”object
An object with update (whether the file should be written to disk) and contents (the file string).
contents
Section titled “contents”contents:
string
update
Section titled “update”update:
boolean
Example
Section titled “Example”const config = defineConfig({ collections: [ defineCollection({ slug: "posts", fields: { title: text() } }), ],});const { update, contents } = generateVexSchema({ config });// update → true// contents → '// ⚠️ AUTO-GENERATED BY VEX CMS ...\nimport { defineTable } from "convex/server"\n...'- collectionConfigToVexSchema for the per-collection string builder
- VexConfig for the resolved config shape