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

[Feature] Add Validation Annotations #114

Open
alexbeattie42 opened this issue Apr 26, 2022 · 3 comments
Open

[Feature] Add Validation Annotations #114

alexbeattie42 opened this issue Apr 26, 2022 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@alexbeattie42
Copy link

alexbeattie42 commented Apr 26, 2022

Problem

I cannot add custom validation class annotations to the generated typescript classes from the prisma.schema

Feature Request

If there is a model that looks like this:

model Organization {
  id    String     @id @default(cuid())
  name  String  @unique
  email String
}

It would be nice to have the ability to add annotations as follows:

model Organization {
  id    String     @id @default(cuid())
  /// @IsNotEmpty()
  name  String  @unique
  /// @IsEmail()
  email String
}

that would create a class like this:

export class CreateOrganizationDto {
  @IsNotEmpty()
  name: string;

  @IsEmail()
  email: string;
}
@TroyMorvant
Copy link

TroyMorvant commented May 18, 2022

Yea, the lack of this feature is going to prevent me from being able to use this library.

@benkroeger benkroeger added enhancement New feature or request help wanted Extra attention is needed labels May 29, 2022
@Brakebein
Copy link

A few months ago, I forked this repo to add some additional features according to our project needs. One of them was to include those class validation decorators. You may want to have a look and try here: https://www.npmjs.com/package/@brakebein/prisma-generator-nestjs-dto

@erlanggadewa
Copy link

@Brakebein nice repo, i will try this and give start
thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Development

No branches or pull requests

5 participants