Skip to content

Add `toSchema` function, to convert any legacy normalizer into a zod schema

Alex Gleason requested to merge to-schema into develop

Summary

Adds toSchema, which can be used like this:

const statusSchema = toSchema(normalizeStatus);

// Use it on a status
statusSchema.parse(status);

// Use it in an entity hook
useEntities(['Statuses'], apiFn, { schema: statusSchema });

Eventually we'll convert everything to zod, but this will help during the transition.

Merge request reports

Loading