-
Notifications
You must be signed in to change notification settings - Fork 70
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
Schema with 'default: "0000-00-00"' became Zod validator 'default(0)' #187
Comments
Hello @robogeek I believe it works if you add /**
* datetime in ISO 8601 format
*
* @format date-time
* @example "2023-06-15T09:30:00.000Z"
* @default "0000-00-00"
*/
export type DateTime = string; |
Yes that's accurate, but with a caveat. Using However, using BUT -- The code I showed above as the Input - that was autogenerated by openapi-codegen. This appears to be a sister project to ts-to-zod? AND, because this is |
The parsing of the https://github.com/fabien0102/ts-to-zod/blob/main/src/core/jsDocTags.ts#L181 A possible solution could be to store the original value that follows value JSDoc tag and later, when both |
We could add handling of single quotes as well in the tag handling if that'd make sense
It seems that it has been created by the same person, indeed. If the code is wrongly generated there, maybe the fix should be made there?
I think that would add complexity to the |
Bug description
An OpenAPI schema with
type: string
,format: date-time
anddefault: 0000-00-00
becomesdefault(0)
in code generated byts-to-zod
Full into: fabien0102/openapi-codegen#211
Input
Expected output
Actual output
Versions
v4.5.3
v3.22.4
The text was updated successfully, but these errors were encountered: