You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically .openapi({example: 'John Doe'}) is appended as a string to already default generated type z.string()
Describe alternatives you've considered
Using /// @zod.custom.use(z.string().openapi({example: 'John Doe'})) but it will overwrite whole type, while I just want extend it append to default generated type
Put a comment and then use bash script to format correct schema
The text was updated successfully, but these errors were encountered:
valerii15298
changed the title
[Feature Request] support for custom string appending for generated type
[Feature Request] appending custom string to generated type
Sep 22, 2024
Just chiming in here that this would also open up support for zod-to-openapi (looks like a similar independent library). I've tried other methods and it's seeming just not able to be done yet.
Additionally, other supported methods like .describe() aren't available without overriding the original type as well (that errors with 'describe' is not a valid validator type.)
Is your feature request related to a problem? Please describe.
I wanna use prisma with Hono zod-opeapi
Basically like this:
Describe the solution you'd like
The best solution would be just to append any string to generated schema type like this
So that after
@append
there could be any string.And it will generate:
Basically
.openapi({example: 'John Doe'})
is appended as a string to already default generated typez.string()
Describe alternatives you've considered
Using
/// @zod.custom.use(z.string().openapi({example: 'John Doe'}))
but it will overwrite whole type, while I just want extend it append to default generated typePut a comment and then use bash script to format correct schema
The text was updated successfully, but these errors were encountered: