Skip to content

Conversation

@minolmal
Copy link

What’s Changed

This PR adds the multipartContent and multipartContentRequired used with "mulitpart/form-data" for adding content request schemas from zod-openapi. This was structured replicating existing jsonContent to keep uniformity in the library.
A FileUploadSchema was added to mostly as a demonstration.

⚠️ Lookout!

const FileUploadSchema = z.object({
  file: z.file().openapi({
    example: "test.png",
    type: "object",
  }),
});

type: "object" in .openapi({}) is crucial to properly generate openapi doc.


This change ensures the OpenAPI examples are valid, minimal, and compatible with tools like Scalar validators. It also improves the developer experience when generating schemas with @hono/zod-openapi.

Let me know if you'd like changes, happy to adjust to fit the project direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant