Replies: 4 comments 1 reply
-
@APTy , this is not a bug of The theory of the original issue's author is most likely correct, but it does not mean that Please refer to the maintainer of Meanwhile, until the bug in that generator is not fixed, you'd have to set |
Beta Was this translation helpful? Give feedback.
-
I've come across this issue multiple times as well, and IMO, the solution here would be not including the |
Beta Was this translation helpful? Give feedback.
-
Well... I'm still not sure about this, @LufyCZ
Taking all that into account, I presume, that it could be configurable. |
Beta Was this translation helpful? Give feedback.
-
🚀 in v22.11.0 you can disable the default min/max range by setting |
Beta Was this translation helpful? Give feedback.
-
Description
This feels like it'd be a common issue, but there's very little information about it online, and the error message is not very clear.
It occurs when using
z.number()
in your types and then trying to generate HTML docs based on that.It seems related to OpenAPITools/openapi-generator#12111. If that issue author's theory is correct, then maybe a solution would be for
zod-express-api
to use a default min/max ofmin(-1 * Number.MAX_VALUE / 10).max(Number.MAX_VALUE / 10)
.Expected
I expected to be able to use a
z.number()
type and then generate HTML docs based on that.Reproduction
z.number()
in one of the typesnew Documentation({ ... }).getSpecAsYaml()
and write toapi.yaml
openapi-generator-cli generate -g html -i api.yaml
Workarounds
Currently, using
z.number().int()
is a workaround if you don't need decimal precision. Or you can also set reasonablemin().max()
manually based on your use case.EDIT: Probably using these workarounds is the correct thing to do until the problem is fixed in
openapi-generator
project.. it does seem likeexpress-zod-api
's behavior working as intended, and it's the other library that is broken.Context
express-zod-api
version: ^19.2.2Appreciate your help!
Beta Was this translation helpful? Give feedback.
All reactions