-
-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(clients): add zod #785
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Thanks @anymaniax ! I think this will be a nice addition to orval. I wonder if it would be possible to import |
@aodinok you have custom validation or using something like |
We are using yup at the moment |
If I do the same for yup would it work for you? example |
I think the problem with this schemas would be that it is hard to modify/extend them. |
Probably a mix of both would be great |
Yeah exactly. Basics plus model schemas - and then you can use whole model schema when needed or basics with custom schema. No need to build yup specifically for us. I'm happy to contribute using your example for zod when I will have some spare time. Thanks a lot for adding this 👍 |
@anymaniax Sure, no problem. Started with this a couple of months ago but that only included Zod schemas for component.schemas and not for the different API calls. Thanks for finishing this :) |
@stijnvanhulle from what I saw it's based on pathItem. Which is great for a first version. I would like to split by schema but before the v7 it's not possible I need to refactor the config and the output system by package first. |
This is cool! Thanks for letting me know. I think we will be able to use this for our use case. |
|
||
export const getZodDependencies = () => ZOD_DEPENDENCIES; | ||
|
||
const resolveZodType = (schemaTypeValue: SchemaObject['type']) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type can be array in OpenAPI, e.g. type: ["string", null]
is this being handled in some internal lib?
I think we have a good enough first version I will merge this |
@anymaniax Is it possible to create a new version so we can start playing around with the Zod integration? |
just git clone the branch from github directly, good idea to check it out. I ran it and had a few issues, I'll try to open an issue. |
Hello guys, @stijnvanhulle I did an alpha version you can try it with |
@stijnvanhulle @sirtimbly just published Orval 6.13.1 |
Due to the demand, I add the new client zod 🎉.
Thanks to @stijnvanhulle, who previously did the implementation. I hope it's ok for you I took what you did as a starting point.