Skip to content
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

A few ideas #65

Open
kamilmysliwiec opened this issue Aug 23, 2023 · 8 comments
Open

A few ideas #65

kamilmysliwiec opened this issue Aug 23, 2023 · 8 comments

Comments

@kamilmysliwiec
Copy link

Hey @risen228, great job on creating this package! NestJS creator here.

I recently started working on the @nestjs/zod package to simplify the integration between the two (Nest and Zod), and then I came across your package and noticed that it already provides several features I planned to add to the official library (great job!)

So I'd like to suggest a few improvements/questions, just in case you have some time:

  • instead of patching the @nestjs/swagger, you could add a static _OPENAPI_METADATA_FACTORY method to your Zod DTO classes (see screenshot below - from my local project)
    image
  • guards shouldn't be used for validating input payload (incoming dtos)
  • any reason Zod isn't declared as a peer dependency?
  • ValidationPipe could expose a few additional options (screenshot form my local project)

image

Fantastic job again!

@risen228
Copy link
Collaborator

risen228 commented Aug 23, 2023

Thanks for your suggestions! I will try to find a time to implement it. Doesn't have much at this moment :/

As I remember, the reason why Zod was removed from peers is /frontend library scope, which doesn't require Zod. It would be a right way to split this library in multiple, but nestjs-zod historically is the single package, so it's not easy to do this.

I hope you will come out with the official Zod + NestJS integration soon =)

P.S. As I see, Zod is specified in peer deps, but I think the range is not good, I did it hastily and it should be fixed to allow only ^3 and ^4 versions of Zod

@Scalahansolo
Copy link

@kamilmysliwiec Interesting to see that your thinking about / working on an official zod package?

With the existence of this package, is your thought this package would become the official recommendation for using Zod with NestJS, or do you still plan to build out an official @nestjs/zod package?

@oskarstucki
Copy link

@kamilmysliwiec I would also be interested in knowing 👍

@DavidVaness
Copy link

@BenLorantfy excited you started maintaining this package. Given @kamilmysliwiec idea to make an official package, what about transferring it to the nestjs org to ensure this stays maintained going forward? I bet you can keep the role of maintainer, but this would ensure stability going forward

Either way, great you reopened this issue 👍🏼

@ohroy

This comment was marked as duplicate.

@Alivers

This comment was marked as duplicate.

@johannessjoberg

This comment was marked as duplicate.

@BenLorantfy
Copy link
Owner

@DavidVaness I think an official package is a good idea, but I think it makes sense to implement some of the suggestions from the OP first to get it aligned with nestjs recommendations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants