Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example with fastify-type-provider-zod #559

Open
2 tasks done
siddarth opened this issue Dec 19, 2024 · 1 comment
Open
2 tasks done

example with fastify-type-provider-zod #559

siddarth opened this issue Dec 19, 2024 · 1 comment

Comments

@siddarth
Copy link

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

Thank you for all of the work you're putting into this project: it's been a pleasure to use.

It would be great if you could add an example of using multipart form-uploads with the the fastify-type-provider-zod to the README. Between fastify/swagger, fastify-type-provider-zod and fastify/multipart, I'm at a bit of a loss on what the Correct Way to play nicely across these three.

Motivation

No response

Example

No response

@ViniciusLeviVL
Copy link

ViniciusLeviVL commented Jan 7, 2025

Added, waiting merge #564

Note: In my project I need to verify if the file exists in refine or it throws an error, so is recommended just disable it using hide: true, but if you need it, this could be helpful

z.custom<MultipartFile>()
  .refine(
    (file) => // Don't verify in refine if the file exists throws an error in Swagger UI
      !file || (!!file && file.file.bytesRead <= 10 * 1024 * 1024),
    {
      message: 'The image must be a maximum of 10MB.',
    },
  )

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

No branches or pull requests

2 participants