gemini-cli-extensions / gemini-cli-extensions/workspace
refactor(calendar): extract validation logic into a separate layer
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 638
- Forks
- 107
- PR merge metrics
- No merged PRs in 30d
Description
Context
From PR #308 review feedback by @abhipatel12:
The validations here make sense. At some point it may make sense to have a validation layer to separate all this logic to make it easier to read.
Problem
CalendarService.createEvent and updateEvent have accumulated significant inline validation logic:
- start/end dateTime vs date exclusivity checks
- eventType-specific constraints (focusTime/outOfOffice can't be all-day)
- workingLocationProperties required sub-property validation
- summary requirements based on eventType
- ISO 8601 datetime format validation
- Email format validation
This makes the methods harder to read and the validation harder to reuse or test independently.
Proposal
Extract calendar event validation into a dedicated module (e.g. CalendarValidation.ts) that:
- Consolidates all input validation for
createEventandupdateEvent - Returns structured validation errors
- Can be unit tested independently of the service
- Keeps the service methods focused on API interaction logic
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating CalendarService.createEvent and updateEvent and read the existing inline checks listed in the issue. Extract them into a dedicated CalendarValidation.ts module with structured errors, then add independent unit tests covering those validations while confirming the service still handles API interaction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100