-
Notifications
You must be signed in to change notification settings - Fork 28
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
Prisma Type
not supported
#2
Comments
I have recently implemented support of composite types, but I haven't published it yet, because it isn't yet complete regarding class validation. And triple-slash comments aren't parsed by the underlying prisma parser (see prisma/prisma#13726), so the properties cannot be annotated. But the basics do work, so I could release a beta version which you can test. |
Absolutely, that would be amazing. Also, on a separate note, maybe I can open an issue for this, or even open a PR, but is there any way to disable swagger generation / disable generation of entities? I could definitely browse through the code base and see if I can implement it myself thought. |
I just did some improvements regarding the composite types and just released beta version, which you can check out: https://www.npmjs.com/package/@brakebein/prisma-generator-nestjs-dto/v/1.13.0-beta.0 You can set |
It's working wonders so far, thanks so much. I'll let you know if I run into any issues. |
I've been using it for a few days now, and so far it's worked well, besides one issue. I have a route to update a product in my backend, this takes the body parameter To clarify, I want to be able to turn this: @IsOptional()
@IsArray()
@ValidateNested({ each: true })
@Type(() => UpdateVariationDto)
variations?: UpdateVariationDto[]; into this, since I need each array item to be a full variation entry, not a partial one: @IsOptional()
@IsArray()
@ValidateNested({ each: true })
@Type(() => CreateVariationDto)
variations?: CreateVariationDto[]; Would this be possible with a triple-slash decorator on the field in the Prisma schema? model Product {
id String @id @default(auto()) @map("_id") @db.ObjectId
name String
description String
price Float?
/// @NoPartialUpdate (or something of the sorts)
variations Variation[]
images Image[] // This property has the same issue, all the indices are validated by `UpdateImageDto`
} |
I added the annotation |
Hey, this project has been a lifesaver for maintaining a source of truth for my project, but I have recently ran into errors while using the
Type
keyword in my Prisma schema. This is used to model embedded documents within a MongoDB based schema.I get this error, probably because it expects a
Model
and not aType
:"Error: related model 'Variation' for 'Product.variations' not found"
The text was updated successfully, but these errors were encountered: