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 |
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