Open darvesh opened 6 days ago
I have tried
@JoiSchemaOptions({})
@JoiSchemaCustomization((schema) => joi.array().items(schema))
class ThrillerDto {
@JoiSchema(Joi.number().required())
thrill!: number;
}
but it results in a type error
Type 'ArraySchema<any[]>' is missing the following properties from type 'ObjectSchema<any>': and, append, assert, instance, and 13 more.ts(2740)
defs.d.ts(9, 48): The expected type comes from the return type of this signature.
@JoiSchemaCustomization()
seems the way to go here, have you adjusted the body definition?
@Injectable()
class Thriller{
createBulk(
@Body() body: ThrillerDto[] // <--- declared as array
){
//create thriller
}
}
Yeah, I have. I think the return type needs a fix in JoiSchemaCustomization
For example; I have this schema
I want to receive an array in the body of ThrillerDto