gemini-cli-extensions / gemini-cli-extensions/workspace

refactor(calendar): extract validation logic into a separate layer

Open
#313 1 comment 0 reactions 0 assignees View on GitHub

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 createEvent and updateEvent
  • Returns structured validation errors
  • Can be unit tested independently of the service
  • Keeps the service methods focused on API interaction logic

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.