Skip to content

Migrates 'external connection list' to Zod. Closes #6904#7184

Draft
MartinM85 wants to merge 1 commit intopnp:mainfrom
MartinM85:feature/6904-external-connection-list-zod
Draft

Migrates 'external connection list' to Zod. Closes #6904#7184
MartinM85 wants to merge 1 commit intopnp:mainfrom
MartinM85:feature/6904-external-connection-list-zod

Conversation

@MartinM85
Copy link
Copy Markdown
Contributor

Closes #6904

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

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 schema implementation for the command using globalOptionsZod.
  • Exported the command’s options schema 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({})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The commandOptionsSchema.parse is redundant and can be removed, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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 }) });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The commandOptionsSchema.parse is redundant and can be removed, no?

@milanholemans milanholemans marked this pull request as draft April 17, 2026 22:14
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 'external connection list' to Zod

3 participants