React Hook Form uses a resolver-based architecture that cleanly separates form handling from schema validation. This makes it one of the easiest form libraries to migrate between schema libraries — SchemaShift handles both the schema conversion and the resolver import rewriting in a single command.
SchemaShift migrates both the schema definitions and the resolver imports. Here is a typical React Hook Form component before and after migrating from Yup to Zod:
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
import * as yup from 'yup';
const schema = yup.object({
email: yup.string().email().required(),
password: yup.string().min(8).required(),
});
const { register, handleSubmit } = useForm({
resolver: yupResolver(schema),
});
import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { z } from 'zod';
const schema = z.object({
email: z.string().email(),
password: z.string().min(8),
});
const { register, handleSubmit } = useForm({
resolver: zodResolver(schema),
});
Notice that both the schema library imports and the resolver function are rewritten
automatically. The useForm call itself remains unchanged — only the
resolver wrapper function changes.
SchemaShift's FormResolverMigrator detects @hookform/resolvers
imports in your source files and rewrites them to match your target schema library. This
happens automatically during any migration that involves a supported form library.
| Migration Path | Source Resolver | Target Resolver |
|---|---|---|
| Yup → Zod | yupResolver |
zodResolver |
| Joi → Zod | joiResolver |
zodResolver |
| Zod → Valibot | zodResolver |
valibotResolver |
| Zod → Yup | zodResolver |
yupResolver |
| Valibot → Zod | valibotResolver |
zodResolver |
The import path is also updated (e.g., @hookform/resolvers/yup becomes
@hookform/resolvers/zod).
No special flags are needed — resolver migration is automatic when SchemaShift detects React Hook Form in your project:
# Preview changes first
schemashift migrate ./src -f yup -t zod --dry-run
# Run the migration
schemashift migrate ./src -f yup -t zod
# Use the react-hook-form preset for guided migration
schemashift migrate ./src --preset react-hook-form-yup-to-zod
The react-hook-form-yup-to-zod preset is a built-in migration template
that configures optimal settings for React Hook Form projects. Use
schemashift presets to see all available templates.
@hookform/resolvers includes the resolver for your target library.
The zodResolver has been available since v3.0.0. Run
npm install @hookform/resolvers@latest after migration.
formState.errors provides), you may need to update those accessors. The
resolver layer normalizes most differences, but custom error rendering logic should be
reviewed.
zodResolver(schema, { mode: 'sync' })). These options are resolver-specific
and are not automatically migrated. SchemaShift preserves the second argument as-is and
adds a TODO comment if it detects resolver options.
npm install @hookform/resolvers@latest to ensure resolver compatibilityTODO(schemashift) comments in migrated filespackage.json if no longer needed
Run schemashift migrate ./src -f yup -t zod and SchemaShift will
automatically detect React Hook Form usage, convert your Yup schemas to Zod, and
rewrite yupResolver imports to zodResolver. Make sure
@hookform/resolvers is updated to a version that supports Zod. Use
--dry-run first to preview changes.
Yes. SchemaShift's FormResolverMigrator detects resolver imports from
@hookform/resolvers and rewrites them to match your target schema library.
It handles yupResolver to zodResolver,
joiResolver to zodResolver, and zodResolver
to valibotResolver automatically.
Yes. After migrating your schemas, ensure @hookform/resolvers is at a
version that includes the resolver for your target library. SchemaShift rewrites the
import statements, but you should run
npm install @hookform/resolvers@latest to get the latest resolver support.
The package has included zodResolver since v3.0.0.
React Hook Form's resolver architecture makes schema migration straightforward. SchemaShift handles both the schema conversion and resolver rewriting automatically.
npm install -g schemashift-cli
Resolver migration requires the Individual tier or above. View pricing.