Skip to content

Migrates 'context option list' to Zod. Closes #6910#7222

Merged
milanholemans merged 3 commits intopnp:mainfrom
MartinM85:feature/6910-context-option-list-zod
Apr 24, 2026
Merged

Migrates 'context option list' to Zod. Closes #6910#7222
milanholemans merged 3 commits intopnp:mainfrom
MartinM85:feature/6910-context-option-list-zod

Conversation

@MartinM85
Copy link
Copy Markdown
Contributor

Closes #6910

Copy link
Copy Markdown
Member

@waldekmastykarz waldekmastykarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review Summary

PR: #7222 - Migrates 'context option list' to Zod
Author: @MartinM85

Overview

Clean Zod migration. The schema, getter, export, and test updates all follow the expected pattern. One minor inconsistency found.

Findings

  1. [Warning] option-list.spec.ts (line 75) — The handles an error when reading file content fails test still passes raw { options: { debug: true } } instead of using commandOptionsSchema.parse({ debug: true }). The other two command.action() calls were updated but this one was missed.
await assert.rejects(command.action(logger, { options: commandOptionsSchema.parse({ debug: true }) }), new CommandError(`Error reading .m365rc.json: Error: An error has occurred. Please retrieve context options from .m365rc.json manually.`));

Checklist Coverage

Verified: single quotes, async/await, no any types in new code, no commented-out code, no PII in telemetry, logger patterns, Zod schema structure. Documentation items not applicable (no new command or behavior change).


Reviewed against the PR checklist.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the m365 context option list command to the repository’s Zod-based option validation approach as part of the broader CLI validation refactor (closes #6910).

Changes:

  • Added a Zod schema for context option list based on globalOptionsZod.
  • Updated unit tests to use the command’s parsed/refined Zod schema via getSchemaToParse() and validate unknown options.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/m365/context/commands/option/option-list.ts Introduces a Zod options schema and exposes it via the command’s schema getter.
src/m365/context/commands/option/option-list.spec.ts Updates tests to validate/parse options using the Zod schema and adds basic schema validation tests.

Comment thread src/m365/context/commands/option/option-list.ts Outdated
@milanholemans milanholemans merged commit 0b80239 into pnp:main Apr 24, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate 'context option list' to Zod

4 participants