❓ openapi schema can auto-convert z.date() -> zChanged.dateOut() #537
Replies: 4 comments 2 replies
-
Hello @HardCoreQual
Your endpoint can not receive Therefore, the way to transmit the dates is by converting them to strings. However, there is an incoming and an outgoing data flow in your Endpoint. That's why I made You say that you're using some generator (Prisma ORM) to create zod schemas. So, I believe the generator you mentioned should either be improved or you'd have to adjust its results, or you can write zod schema yourself. |
Beta Was this translation helpful? Give feedback.
-
in standard situations z.date() work fine for OUTPUT because |
Beta Was this translation helpful? Give feedback.
-
Yes, in case of the output, |
Beta Was this translation helpful? Give feedback.
-
Here is an interesting thing regarding incoming date problem. There is a however a question: how to detect such string reliably and fast. |
Beta Was this translation helpful? Give feedback.
-
now z.date() from output schema in during generete OpenApi.response will throw error
Zod type ZodDate is unsupported
for example prisma ORM have zod generator that will create z.date(), but now it don't can be used
Think for z.dateIn() will require more complex logic that will rewrite each enpoint.input for replace date for make that it work in openapi-generator and in endpoint.input
Beta Was this translation helpful? Give feedback.
All reactions