Open clabnet opened 8 months ago
@clabnet yes the schemas you mentioned can be used for CRUD operations. I personally use it with trpc
but have not used it with swagger
or fastify
In your example you also just used the type of the FindMAnyArgsSchema
in
request: FastifyRequest<{ Body: z.infer<typeof drawingFindManyArgsSchema> }>,
but did not validate at runtime if the body actually has the expeced data promised by the type like
const { skip, take, select, orderBy, where } = drawingFindManyArgsSchema.parse(request.body) // or use .safeParse() to not throw any errors directly
maybe this helps to catch any errors in your request body and gives some more traceable error messages
This is a POST to get all drawings using where, select and others parameters.
Using these packages
when click on Swagger page, POST, I have a lot of errors :
Are correct to use these schemas for CRUD operations ??
drawingWhereUniqueInputSchema
drawingFindManyArgsSchema
drawingCreateInputSchema
drawingWhereUniqueInputSchema
anddrawingUpdateInputSchema
drawingWhereUniqueInputSchema
Thanks for your work.