fix(api/v2): make attendee email required in booking schema#28799
fix(api/v2): make attendee email required in booking schema#28799ReetamBG wants to merge 2 commits intocalcom:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis change updates the email validation in the create-booking input file. The 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active. |
|
Thank you for your contribution. This PR is being closed because it modifies code that no longer exists in Cal.diy. reference: blog |
What does this PR do?
This PR enforces the attendee email as a required field in the V2 booking schema (CreateBookingInput_2024_04_15). Previously, the validation used a custom logic
!value || isEmail(value)which allowed falsy values (like empty strings) to pass. This misled the OpenAPI/Swagger generator into marking the field as optional in the documentation.By replacing the custom logic with a strict @isemail() decorator, the API now correctly rejects missing emails with a 400 Bad Request.
Visual Demo (For contributors especially)
Verified the fix via local API request. Below is the response when email is omitted from the request object:
Request object:
Response object:
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
yarn dxandyarn workspace @calcom/api-v2 dev.Checklist