Description
What are the steps to reproduce this issue?
- Use Swagger API docs where there is endpoint that use form-data as request body
- Try to generate api with orval.
What happens?
There is no zod validation scheme for the request body that uses form data
What were you expecting to happen?
I want to have something like this
export const createPostSchema = z.object({
file: z.instanceof(File), // Validate file as a File object
name: z.string(), // Name as a required string
subtitle: z.string(), // Subtitle as a required string
text: z.string(), // Text as a required string
publishedAt: z.string().datetime(), // ISO 8601 date-time validation
status: z.boolean(), // Boolean validation
store: z.number().int(), // Integer validation
fixed: z.boolean(), // Boolean validation
imageAlt: z.string().optional(), // Optional string
postTags: z.array(z.number().int()), // Array of integers
});
Any logs, error output, etc?
No
Any other comments?
There is no any problems with other endpoints that don’t use form data. Orval generates for me request body zod validation successfully
Example:
export const postV1RolesCreateBody = zod.object({
name: zod.string().min(1),
title: zod.string().nullish(),
rolePermissions: zod.array(
zod.object({
id: zod.number().optional(),
})
),
});
What versions are you using?
NextJs version: 13, Node version: 20, Orval version: 7.3.0
Activity