Skip to content

Migrate outlook message and mail commands to Zod#7374

Open
waldekmastykarz wants to merge 2 commits into
pnp:mainfrom
waldekmastykarz:waldekmastykarz/migrate-outlook-to-zod
Open

Migrate outlook message and mail commands to Zod#7374
waldekmastykarz wants to merge 2 commits into
pnp:mainfrom
waldekmastykarz:waldekmastykarz/migrate-outlook-to-zod

Conversation

@waldekmastykarz
Copy link
Copy Markdown
Member

What's in this PR

Migrates the outlook message and outlook mail commands to use Zod validation schemas, replacing the legacy interface-based validation pattern.

Commands migrated

  • outlook message get
  • outlook message list
  • outlook message move
  • outlook message remove
  • outlook mail send

Changes per command

  • Removed constructor, #initTelemetry(), #initOptions(), #initValidators(), #initTypes(), #initOptionSets()
  • Added exported Zod schema (options) with z.strictObject()
  • Added get schema() and getRefinedSchema() methods
  • Updated test files to use commandOptionsSchema.safeParse() for validation tests

Notes

  • mail-send.ts keeps this.validators for filesystem-dependent attachment validation (file existence/size checks can't be expressed as Zod schemas)
  • mail-searchfolder-add.ts was already migrated and is not part of this PR

Closes #7308

Migrates the following commands to use Zod validation schemas:
- outlook message get
- outlook message list
- outlook message move
- outlook message remove
- outlook mail send

Closes pnp#7308

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@milanholemans
Copy link
Copy Markdown
Contributor

@waldekmastykarz, seems like not all code is covered by tests.

@milanholemans milanholemans marked this pull request as draft May 28, 2026 15:21
Add explicit tests for schema getters, refined schemas, and Zod
error callbacks (invalid GUID/UPN) to reach 100% function coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@waldekmastykarz waldekmastykarz marked this pull request as ready for review May 29, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate outlook message and outlook mail commands to Zod

2 participants