Migrates 'spo cdn' commands to Zod. Closes #7321#7428
Open
MartinM85 wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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
schemadefinitions for allspo 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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7321