You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When attempting to create a model that includes a composite type field using factory, the creation fails with a validation error. The error indicates that the composite type field is "missing" even though it should be automatically handled by the factory.
Example schema:
model Speaker {
id String @id @default(auto()) @map("_id") @db.ObjectId
name String
thumbnail ImageData
@@map("speakers")
}
type ImageData {
uri String
width Int
height Int
}
This appears to be an issue with how fabbrica handles composite types in its factory generation or execution process.
To Reproduce
Set up a new Prisma project with MongoDB as the database provider
Add the following schema to your schema.prisma:
datasource db {
provider = "mongodb"
url = env("MONGODB_URL")
}
model Speaker {
id String @id @default(auto()) @map("_id") @db.ObjectId
name String
thumbnail ImageData
@@map("speakers")
}
type ImageData {
uri String
width Int
height Int
}
Generate the factories by prisma generate
Try to create a Speaker using the generated factory:
Expected behavior
The factory should automatically generate valid test data for all fields, including the composite type ImageData.
Environment (please complete the following information):
Database kind: MongoDB
Node.js version: 22.11.0
@prisma/client version: 5.22.0
TypeScript version: 5.6.3
Your Schema
See To Reproduce section
Additional context
Upon examining the generated factory code, I found that the modelFieldDefinitions for the ImageData composite type has an empty relationName:
This empty relationName for the composite type field might be contributing to the validation error, as it could affect how fabbrica handles the field during factory creation.
The text was updated successfully, but these errors were encountered:
Describe the bug
When attempting to create a model that includes a composite type field using factory, the creation fails with a validation error. The error indicates that the composite type field is "missing" even though it should be automatically handled by the factory.
Example schema:
The factory creation throws the following error:
This appears to be an issue with how fabbrica handles composite types in its factory generation or execution process.
To Reproduce
schema.prisma
:prisma generate
Expected behavior
The factory should automatically generate valid test data for all fields, including the composite type
ImageData
.Environment (please complete the following information):
@prisma/client
version: 5.22.0Your Schema
See To Reproduce section
Additional context
Upon examining the generated factory code, I found that the
modelFieldDefinitions
for the ImageData composite type has an emptyrelationName
:This empty
relationName
for the composite type field might be contributing to the validation error, as it could affect how fabbrica handles the field during factory creation.The text was updated successfully, but these errors were encountered: