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

Add example with fastify-type-provider-zod for docs #564

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ViniciusLeviVL
Copy link

This PR enhances the project documentation by adding a new use case for body validation using Zod in conjunction with fastify-type-provider-zod. The example demonstrates how to validate multipart form-data requests, including custom refinements for file size and type validation.

Changes Made:

  • Added a new section in the README.md titled "Zod Schema body validation".
  • Provided a step-by-step guide for integrating Zod with Fastify.
  • Included example code for setting up multipart validation with zod.
  • Added refinements examples for file size (maximum 10MB) and type (only images).
  • Clarified limitations with Zod (FormData support) and fastify-type-provider-zod (Swagger support).

Checklist

  • Documentation is changed or added.
  • Verified example code is functional.

@ViniciusLeviVL ViniciusLeviVL changed the title Add example with fastify-type-provider-zod for docs Add example with fastify-type-provider-zod for docs Resolver#559 Jan 7, 2025
@ViniciusLeviVL ViniciusLeviVL changed the title Add example with fastify-type-provider-zod for docs Resolver#559 Add example with fastify-type-provider-zod for docs Resolves #559 Jan 7, 2025
@ViniciusLeviVL ViniciusLeviVL changed the title Add example with fastify-type-provider-zod for docs Resolves #559 Add example with fastify-type-provider-zod for docs Jan 7, 2025
@ViniciusLeviVL
Copy link
Author

ViniciusLeviVL commented Jan 7, 2025

Issue #559

Copy link
Member

@Fdawgs Fdawgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be better as an actual example in the examples directory, rather than dedicating a section of the docs to it.

@ViniciusLeviVL
Copy link
Author

This would be better as an actual example in the examples directory, rather than dedicating a section of the docs to it.

I agree that dedicating a section to this might clutter the documentation, but having it only as an example in the examples directory might not reach as many people due to SEO, as many users search directly in the browser. I believe the best option would be to include the example along with a reference, link, or something similar to the examples directory. What do you think about this?

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.

2 participants