Badget icon indicating copy to clipboard operation
Badget copied to clipboard

Feature: Add Zod Resolver for Enhanced Type Safety in Form Handling

Open Codehagen opened this issue 1 year ago • 2 comments

Type of feature

💡 Feature

Current behavior

The <AddRealEstateButton> component allows users to input details about real estate properties, including address, city, state, postal code, purchase date, purchase value, and current value. While this functionality is crucial for adding new property details, the current implementation lacks type-safe form handling, potentially leading to runtime errors and data inconsistency.

Suggested solution

Read Shadcn documentation before implementation: Shadcn Forms For the datepicker read this at the bottom: Shadcn Datepicker

I propose integrating Zod with our form handling to enhance type safety and validation. Zod will allow us to define a schema for the form data, ensuring that the data conforms to the specified structure and types before it's processed or sent to the backend.

Steps to Implement:

  1. Define Zod Schema: Create a Zod schema that outlines the structure and expected types for the form data. This schema should include validations for all fields present in the AddRealEstateButton component's form.

  2. Integrate Zod with Form Handling: Utilize the Zod resolver within our form handling library to validate the form data against the schema. Ensure that form submissions are only processed if the data passes all validations.

  3. Error Handling and Feedback: Implement user-friendly error messages and feedback for form validation errors. This ensures users are clearly informed about any issues with their input and know how to correct them.

image

Additional context

No response

Codehagen avatar Feb 23 '24 09:02 Codehagen

Hi, I would like to take this. This is my first time contributing to open-source, so I might reach out for help if I encounter any issues 😄

chetra-seng avatar Feb 25 '24 12:02 chetra-seng

Hello @chetra-seng - If you want i can assign it to you. Can also help you if you have any questions. Are you on the Discord server?

Codehagen avatar Feb 25 '24 18:02 Codehagen

I just joined ur discord server 😄

chetra-seng avatar Feb 26 '24 05:02 chetra-seng

Hey @meglerhagen, shall we close this issue?

chetra-seng avatar Mar 03 '24 08:03 chetra-seng

Yes! Thanks

Codehagen avatar Mar 03 '24 08:03 Codehagen