Skip to content

Migrates spp commands to Zod. Closes #7346 - #7623

Merged
milanholemans merged 5 commits into
pnp:mainfrom
MartinM85:feature/7346-migrate-spp-commands-to-zod
Oct 20, 2026
Merged

milanholemans merged 5 commits into
pnp:mainfrom
MartinM85:feature/7346-migrate-spp-commands-to-zod

Conversation

@MartinM85

Copy link
Copy Markdown
Contributor

Closes #7346

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.

🟡 Changes recommended

Model get and remove need negative regression tests for their newly command-local selector constraints.

2 open issues
What changed in this PR

Migrates the four spp commands in #7346 to the CLI’s Zod validation pattern.

Changes:

  • Replaces legacy option registration and validation with strict schemas.
  • Moves model selector constraints into schema refinements.
  • Updates tests to parse schemas and reject unknown options.
File Description
src/​m365/​spp/​commands/​model/​model-remove.ts Adds removal options schema and selector constraint.
src/​m365/​spp/​commands/​model/​model-remove.spec.ts Migrates removal tests to schema parsing.
src/​m365/​spp/​commands/​model/​model-list.ts Adds site URL validation schema.
src/​m365/​spp/​commands/​model/​model-list.spec.ts Migrates listing tests to schema parsing.
src/​m365/​spp/​commands/​model/​model-get.ts Adds retrieval options schema and selector constraint.
src/​m365/​spp/​commands/​model/​model-get.spec.ts Migrates retrieval tests to schema parsing.
src/​m365/​spp/​commands/​contentcenter/​contentcenter-list.ts Adds strict global-options schema.
src/​m365/​spp/​commands/​contentcenter/​contentcenter-list.spec.ts Adds schema validation and updates action tests.

Review effort: Balanced

Comment thread src/m365/spp/commands/model/model-get.spec.ts
Comment thread src/m365/spp/commands/model/model-remove.spec.ts
MartinM85 and others added 4 commits October 20, 2026 21:11
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@milanholemans
milanholemans force-pushed the feature/7346-migrate-spp-commands-to-zod branch from 53e99a3 to e4307cf Compare October 20, 2026 19:19

@milanholemans milanholemans 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.

With a few minor fixes, good to go.

Comment on lines +18 to +21
id: z.string()
.refine(val => validation.isValidGuid(val), {
message: `The value specified for option 'id' is not a valid GUID.`
})

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.

Let's use .guid().

Comment on lines +20 to +23
id: z.string()
.refine(val => validation.isValidGuid(val), {
message: `The value specified for option 'id' is not a valid GUID.`
})

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.

.guid()

@milanholemans
milanholemans merged commit b28d0cb into pnp:main Oct 20, 2026
9 of 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 spp commands to Zod

3 participants