zod-prisma-types
zod-prisma-types copied to clipboard
Swagger resolve errors - Could not resolve pointer
This is a POST to get all drawings using where, select and others parameters.
export async function getAllDrawings(
request: FastifyRequest<{ Body: z.infer<typeof drawingFindManyArgsSchema> }>,
reply: FastifyReply
): Promise<drawing[]> {
try {
const { skip, take, select, orderBy, where } = request.body
const data = await prisma.drawing.findMany({
select: select,
where: where,
orderBy: orderBy,
take: take ? Number(take) : 10,
skip: skip ? Number(skip) : undefined,
})
if (!data || data.length === 0) {
return reply.status(404).send({ message: 'No drawings found' })
}
return reply.status(200).send(data)
} catch (error) {
console.error(error)
return reply.status(500).send({
message: 'Error fetching drawings',
})
}
}
Using these packages
"@fastify/swagger": "^8.12.0",
"@fastify/swagger-ui": "^1.10.1",
when click on Swagger page, POST, I have a lot of errors :
Resolver error at paths./drawings/.post.requestBody.content.application/json.schema.properties.where.properties.AND.anyOf.0.$ref
Could not resolve reference: Could not resolve pointer: /properties/where does not exist in document
Resolver error at paths./drawings/.post.requestBody.content.application/json.schema.properties.where.properties.AND.anyOf.1.items.$ref
Could not resolve reference: Could not resolve pointer: /properties/where does not exist in document
Resolver error at paths./drawings/.post.requestBody.content.application/json.schema.properties.where.properties.OR.items.$ref
Could not resolve reference: Could not resolve pointer: /properties/where does not exist in document
Resolver error at paths./drawings/.post.requestBody.content.application/json.schema.properties.where.properties.NOT.anyOf.0.$ref
Could not resolve reference: Could not resolve pointer: /properties/where does not exist in document
.....
Are correct to use these schemas for CRUD operations ??
- getByID :
drawingWhereUniqueInputSchema
- getAll :
drawingFindManyArgsSchema
- create :
drawingCreateInputSchema
- update :
drawingWhereUniqueInputSchema
anddrawingUpdateInputSchema
- delete :
drawingWhereUniqueInputSchema
Thanks for your work.