Use Zod in storefront #6030
Unanswered
FlorianCousin
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I would like to use a schema validator in the storefront when the data comes from the medusa backend.
I saw there is a
@medusajs/client-types
that includes all the TS types that medusa backend uses in the requests response.However, these types are numerous and cyclic.
Do you know any good way to generate a zod schema from these client types ?
I tried to use ts-to-zod but it does not work on circular types.
I tried to use medusa oas in order to generate zod schema from openapi file, but I have this error that does not seem to be solved.
Has anyone already used zod on a storefront with a medusa backend ?
Do you have any idea on how to generate the schema ?
Beta Was this translation helpful? Give feedback.
All reactions