Migrates 'external connection list' to Zod. Closes #6904#7184
Migrates 'external connection list' to Zod. Closes #6904#7184
Conversation
There was a problem hiding this comment.
Pull request overview
This PR completes the Zod migration for the external connection list command by introducing a Zod options schema (based on global options) and updating tests to validate and use the schema during command execution.
Changes:
- Added a Zod
schemaimplementation for the command usingglobalOptionsZod. - Exported the command’s
optionsschema for reuse in tests. - Updated the spec to validate schema behavior (valid empty options, invalid unknown options) and to pass parsed options into
command.action().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/m365/external/commands/connection/connection-list.ts | Adds Zod-based options schema (global options only) and exposes it via schema. |
| src/m365/external/commands/connection/connection-list.spec.ts | Updates tests to retrieve/validate the schema and pass parse()d options into the command action. |
| await assert.rejects(command.action(logger, { | ||
| options: { | ||
| } | ||
| options: commandOptionsSchema.parse({}) |
There was a problem hiding this comment.
The commandOptionsSchema.parse is redundant and can be removed, no?
There was a problem hiding this comment.
Yes, it's redundant in this case, but the commandOptionsSchema.parse will enforce the schema validation and check at least that no unknown option is passed to the command.
| }); | ||
|
|
||
| await command.action(logger, { options: { debug: true } } as any); | ||
| await command.action(logger, { options: commandOptionsSchema.parse({ debug: true }) }); |
There was a problem hiding this comment.
The commandOptionsSchema.parse is redundant and can be removed, no?
Closes #6904