Skip to content

Commit 831fa85

Browse files
committed
test: convertToOpenAPI with file handler
1 parent e8fafe7 commit 831fa85

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/core/zod-to-openapi.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,26 @@ describe("convertToOpenAPI", () => {
6767

6868
expect(openAPISchema).toEqual(expectedSchema);
6969
});
70+
71+
it("should handle file type correctly in an object", () => {
72+
const zodSchema = z.object({
73+
file: z.instanceof(File),
74+
});
75+
76+
const openAPISchema = convertToOpenAPI(zodSchema, false);
77+
78+
const expectedSchema: SchemaObject = {
79+
type: "object",
80+
properties: {
81+
file: {
82+
type: "string",
83+
format: "binary",
84+
},
85+
},
86+
required: ["file"],
87+
additionalProperties: false,
88+
};
89+
90+
expect(openAPISchema).toEqual(expectedSchema);
91+
});
7092
});

0 commit comments

Comments
 (0)