-
Notifications
You must be signed in to change notification settings - Fork 93
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
[zod-nestjs] inconsistent usage of OAS 3.0.0 vs 3.1.0 (createZodDto doesn't support specifying OAS version) #221
Comments
I found some more discussion on this in #181; it seems like the issues are:
|
#130 (comment) was the closest I've found for an answer. Inferring from the answer, I assume the goal is 3.1 first-class. But I can't imagine it's that much of an issue to support 3.0 at the same time -- the reason I made #173 was because I found working with hybrid 3.0-and-3.1 without any sort of version selection annoying, but that's only annoying due to the lack of version selection not due to the hybrid nature. |
@Brian-McBride @A5rocks do you think any maintainer will be able to investigate this one soon? We're wondering because our team really wants to generate and open API spec that is complete and we depend on this package in our codebase. |
Currently, createZodDto uses
generateSchema
with no argument for the version, which generates a v3.1 spec. It then manually modifies the generated object to attempt to convert it back to v3.0 for nestjs/swagger's sake. This includes things like fixing "exclusiveMinimum" being a number (not boolean), or types being an array, with 'null' as a type rather than using "nullable".This is inconsistent with patchNestjsSwagger, which supports passing in v3.0 or v3.1 (defaulting to v3.0, and forwarding that to
generateSchema
), but fails to properly convert several things to v3.0 (such as nullable for v3.0, as mentioned in this issue, or exclusiveMinimum).These issues combined generate a spec where half will be 3.0.0 (manually downgraded from 3.1.0 in createZodDto) and the other half will either be valid 3.1.0 (from patchNestjsSwagger overridden to v3.1.0) or corrupt 3.0.0 (due to issues like #211).
Overall it seems like this library is in a broken state, supporting v3.0 half-way and v3.1 half-way, but neither the entire way unfortunately, due to competing interests for supporting one or the other (ex. #173 and #206); I'd love to contribute fixes for these things, but it's unclear the best path to fixing the library (is the goal to support v3.1 first-class and manually convert from that to 3.0 such as in createZodDto, or to actually support generating both 3.0 and 3.1 directly such as in patchNestjsSwagger?). Is there an active owner/maintainer of the repo (@Brian-McBride / @A5rocks) to get thoughts on the best approach to fix these issues from?
The text was updated successfully, but these errors were encountered: