vegardit / prisma-generator-nestjs-dto

Generates NestJS DTO classes from Prisma Schema
Apache License 2.0
274 stars 75 forks source link

Add class-validator support #157

Closed liliwei25 closed 2 years ago

liliwei25 commented 2 years ago

for issue #114

Adds class-validator support

Usage example

/// @Max(5)
count Int

@Max(5) will be parsed and added to CreateDto, UpdateDto and Entity

/// @Max(5)[create, update]
count Int

@Max(5) will be parsed and added to CreateDto and UpdateDto only

/// @Max(5)[create]
/// @Max(10)[update]
count Int

@Max(5) will be parsed and added to CreateDto while @Max(10) will be parsed and added to UpdateDto

Even supports multiline decorators

/// @IsUrl({
///   disallow_auth: false
/// })
url: string

Please review and let me know what can be improved! Thank you!

sebthom commented 2 years ago

Dear Liwei, thanks a lot for your interest in this project and your PR. We however stopped using this package ourselves and thus decided to suspend development until a new maintainer is found.

wiredmatt commented 2 years ago

@sebthom what are you guys using instead?

sebthom commented 2 years ago

@sebthom what are you guys using instead?

@system32uwu we use a completely different approach now. we changed our API from REST to GraphQL

wiredmatt commented 2 years ago

@sebthom what are you guys using instead?

@system32uwu we use a completely different approach now. we changed our API from REST to GraphQL

Thought so, thank you.