abhijeetnishal / URLShortener

URL Shortener Deployed Link 👇🏻
https://urlsrtner.vercel.app
MIT License
37 stars 60 forks source link

[Enhancement] Add zod schema validation for urls and email #86

Closed uttam282005 closed 4 months ago

uttam282005 commented 4 months ago

Title: Implement Zod Validation for URL and Email Inputs

Description: I propose adding Zod validation for URLs and email inputs in the URL shortener project to ensure that the data entered by users is in the correct format, reducing errors and improving the overall reliability of the application.

Rationale:

Proposed Solution:

This enhancement will improve the user experience by providing immediate feedback on the validity of URLs and email inputs, reducing the likelihood of errors. I am willing to contribute to the implementation of this feature and would appreciate any guidance or feedback on how to best proceed.

Request: Please label this issue as a GSSOC (GirlScript Summer of Code) issue and assign it to me for implementation.

Thank you for considering this enhancement.

Debajyoti045 commented 4 months ago

can you please assign this issue to me @abhijeetnishal I know the zod schema well

abhijeetnishal commented 4 months ago

Hey @Debajyoti045, we don't need any external package for input validation it is done using JS function/methods only.

You can contribute to other issues, good luck.

uttam282005 commented 4 months ago

Hey @abhijeetnishal, thanks for responding. I checked the urls.js file and found the js function for url validation. I agree that zod is not needed there, sorry for not noticing that earlier but don't you think validating the email input before signing up a new user will be better? I think it will save a db call and more importantly it will prevent the storage of invalid emails. This code here checks if the user has entered email, password and name but does not validate whether or not it is a valid email. Screenshot 2024-05-16 123646

If you don't want to use any external package then I can use regular expressions for email validation as well. Please tell me your thoughts. Thank you.

abhijeetnishal commented 4 months ago

Hey @abhijeetnishal, thanks for responding. I checked the urls.js file and found the js function for url validation. I agree that zod is not needed there, sorry for not noticing that earlier but don't you think validating the email input before signing up a new user will be better? I think it will save a db call and more importantly it will prevent the storage of invalid emails. This code here checks if the user has entered email, password and name but does not validate whether or not it is a valid email. Screenshot 2024-05-16 123646

If you don't want to use any external package then I can use regular expressions for email validation as well. Please tell me your thoughts. Thank you.

Hey @frumptiousclone, we can handle that from client side, later we will see.

uttam282005 commented 4 months ago

Ok @abhijeetnishal thanks