Closed gvzq closed 2 days ago
It supports form-data!
export const { PUT } = createRoute({
operationId: "uploadFile",
method: "PUT",
summary: "Upload a file",
description: "Uploads a file to the storage service",
tags: ["Upload"],
requestBody: z.object({
file: z.instanceof(File).describe("File object to be uploaded"),
}),
hasFormData: true,
action: async ({ body }) => {
const file = body.file; // this is a File object
},
responses: {
201: { description: "File uploaded successfully", content: FileDTO },
},
});
This is a neat library. I would love to see more extensibility. For example, I would also add the file encodings for multipart/form-data schemas. Is currently a way to accomplish this?
Ideally, exporting a path that looks like this: