Skip to content

Migrates 'spo cdn' commands to Zod. Closes #7321#7428

Open
MartinM85 wants to merge 2 commits into
pnp:mainfrom
MartinM85:feature/7321-migrate-spo-cdn-to-zod
Open

Migrates 'spo cdn' commands to Zod. Closes #7321#7428
MartinM85 wants to merge 2 commits into
pnp:mainfrom
MartinM85:feature/7321-migrate-spo-cdn-to-zod

Conversation

@MartinM85

Copy link
Copy Markdown
Contributor

Closes #7321

Copilot AI left a comment

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.

Pull request overview

Migrates the SharePoint Online spo cdn command group from the legacy initOptions/types/validators model to schema-driven option parsing and validation using Zod, aligning these commands with the newer CLI validation/telemetry pipeline.

Changes:

  • Introduces Zod schema definitions for all spo cdn* commands and removes legacy option/validator initialization.
  • Updates unit tests to use the command schema (getSchemaToParse()) for parsing/validating options.
  • Adds negative validation tests for unknown options via z.strictObject(...).

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/m365/spo/commands/cdn/cdn-get.ts Adds Zod schema for spo cdn get options (type).
src/m365/spo/commands/cdn/cdn-get.spec.ts Updates tests to parse via command schema and validate unknown options.
src/m365/spo/commands/cdn/cdn-origin-add.ts Adds Zod schema for spo cdn origin add options (type, origin).
src/m365/spo/commands/cdn/cdn-origin-add.spec.ts Updates tests to parse via schema; validation tests updated (missing required-option assertion noted).
src/m365/spo/commands/cdn/cdn-origin-list.ts Adds Zod schema for spo cdn origin list options (type).
src/m365/spo/commands/cdn/cdn-origin-list.spec.ts Updates tests to parse via schema and validate unknown options.
src/m365/spo/commands/cdn/cdn-origin-remove.ts Adds Zod schema for spo cdn origin remove options (type, origin, force).
src/m365/spo/commands/cdn/cdn-origin-remove.spec.ts Updates tests to parse via schema; validation tests updated (missing required-option assertion noted).
src/m365/spo/commands/cdn/cdn-policy-list.ts Adds Zod schema for spo cdn policy list options (cdnType).
src/m365/spo/commands/cdn/cdn-policy-list.spec.ts Updates tests to parse via schema and validate unknown options.
src/m365/spo/commands/cdn/cdn-policy-set.ts Adds Zod schema for spo cdn policy set options (cdnType, policy, value).
src/m365/spo/commands/cdn/cdn-policy-set.spec.ts Updates tests to parse via schema; validation tests updated (missing required-option assertions noted).
src/m365/spo/commands/cdn/cdn-set.ts Adds Zod schema for spo cdn set options (type, enabled, noDefaultOrigins).
src/m365/spo/commands/cdn/cdn-set.spec.ts Updates tests to parse via schema; validation tests updated (missing required-option assertion noted).

Comment thread src/m365/spo/commands/cdn/cdn-set.spec.ts
Comment thread src/m365/spo/commands/cdn/cdn-policy-set.spec.ts
Comment thread src/m365/spo/commands/cdn/cdn-origin-add.spec.ts
Comment thread src/m365/spo/commands/cdn/cdn-origin-remove.spec.ts
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 spo cdn commands to Zod

2 participants