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
Hello, thanks for making this - it's super useful!
The Prisma types for nested creates allow for passing an array in the case of a has-many relation, but prisma-factory appears not to handle this case gracefully. Instead, I'm seeing something like the following:
Error:
Invalid `prisma[prismaModel].create()` invocation in
/Users/solomonhawk/Code/Work/mainframe/node_modules/prisma-factory/dist/index.js:109:44
106 data = hooks.beforeCreate(data);
107 }
108 const prismaModel = (0, import_camel_case.camelCase)(modelName);
→ 109 let result = await prisma[prismaModel].create({
data: {
name: 'Name',
slug: 'name',
description: 'description',
author: {
connect: {
email: '[email protected]'
}
},
homepageUrl: 'https://known-bike.info',
sourceUrl: 'https://growing-eavesdropper.biz',
tags: {
create: {
'0': {
name: 'facere',
description: 'Rem nemo repudiandae veritatis enim totam aperiam ipsam nam. Inventore tempore exercitationem labore in dicta saepe eveniet asperiores excepturi. Enim voluptatibus commodi molestiae enim odit doloribus in a sunt.'
},
'1': {
name: 'aliquam',
description: 'Perferendis porro quas natus. Quasi enim sed enim tempora unde amet eveniet aliquam. Eaque reiciendis vel sit placeat repudiandae a dolore incidunt quasi.'
},
+ name: String,
? id?: String,
? description?: String | null
}
}
},
include: {
author: true
}
})
Unknown arg `0` in data.tags.create.0 for type TagCreateWithoutTopicsInput.
Unknown arg `1` in data.tags.create.1 for type TagCreateWithoutTopicsInput.
Argument name for data.tags.create.name is missing.
Hello, thanks for making this - it's super useful!
The Prisma types for nested creates allow for passing an array in the case of a has-many relation, but
prisma-factory
appears not to handle this case gracefully. Instead, I'm seeing something like the following:My factory looks like:
I also tried without the inner lambda
{ create: [TagFactory.build(), TagFactory.build()] }
, but the result is the same.Without delving too deep, perhaps the
typeof value === 'object'
checks here are matching array values erroneously.The following patch seems to resolve the issue:
The text was updated successfully, but these errors were encountered: