Skip to content

Migrates 'spo contenttype' commands to Zod. Closes #7323 - #7542

Open
MartinM85 wants to merge 3 commits into
pnp:mainfrom
MartinM85:feature/7322-migrate-spo-contenttype-commands-to-zod
Open

MartinM85 wants to merge 3 commits into
pnp:mainfrom
MartinM85:feature/7322-migrate-spo-contenttype-commands-to-zod

Conversation

@MartinM85

Copy link
Copy Markdown
Contributor

Closes #7323

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

This pull request migrates the SharePoint Online spo contenttype* command set from the legacy validators/options model to the Zod-based schema model used by the CLI core, aligning these commands with the newer validation and parsing pipeline (issue #7323).

Changes:

  • Added Zod option schemas (and refined schemas for option-set rules) to the spo contenttype* and spo contenttypehub get commands.
  • Updated unit tests to parse action options through command.getSchemaToParse() and added unknown-option validation tests where schemas are strict.
  • Removed legacy #initOptions/#initValidators/#initTypes/#initOptionSets plumbing from migrated commands.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/m365/spo/commands/contenttypehub/contenttypehub-get.ts Adds a Zod schema for global options and exposes it via schema.
src/m365/spo/commands/contenttypehub/contenttypehub-get.spec.ts Updates tests to parse options through the command’s schema; adds strict unknown-option tests.
src/m365/spo/commands/contenttype/contenttype-sync.ts Replaces legacy validation/optionSets with Zod schema + refined option-set rules.
src/m365/spo/commands/contenttype/contenttype-sync.spec.ts Updates tests to use schema parsing and schema-based validation checks.
src/m365/spo/commands/contenttype/contenttype-set.ts Introduces Zod schema (with catchall) + refined rules and keeps allowUnknownOptions() for dynamic update payload.
src/m365/spo/commands/contenttype/contenttype-set.spec.ts Updates tests to use schema parsing and schema-based validation checks.
src/m365/spo/commands/contenttype/contenttype-remove.ts Migrates options/validation to Zod schema + refined option-set rule.
src/m365/spo/commands/contenttype/contenttype-remove.spec.ts Updates tests to use schema parsing and schema-based validation checks; adds strict unknown-option test.
src/m365/spo/commands/contenttype/contenttype-list.ts Migrates options/validation to a strict Zod schema.
src/m365/spo/commands/contenttype/contenttype-list.spec.ts Updates tests to use schema parsing and adds strict unknown-option test.
src/m365/spo/commands/contenttype/contenttype-get.ts Migrates options/validation to strict Zod schema + refined option-set rule.
src/m365/spo/commands/contenttype/contenttype-get.spec.ts Updates tests to use schema parsing and adds strict unknown-option test.
src/m365/spo/commands/contenttype/contenttype-field-set.ts Migrates options/validation to strict Zod schema (including boolean options).
src/m365/spo/commands/contenttype/contenttype-field-set.spec.ts Updates tests to use schema parsing and schema-based validation checks.
src/m365/spo/commands/contenttype/contenttype-field-remove.ts Migrates options/validation to strict Zod schema (incl. GUID + SP URL validations).
src/m365/spo/commands/contenttype/contenttype-field-remove.spec.ts Updates tests to use schema parsing and schema-based validation checks.
src/m365/spo/commands/contenttype/contenttype-field-list.ts Migrates options/validation to strict Zod schema + refined option-set rules.
src/m365/spo/commands/contenttype/contenttype-field-list.spec.ts Updates tests to use schema parsing and adds strict unknown-option test.
src/m365/spo/commands/contenttype/contenttype-add.ts Migrates options/validation to strict Zod schema for add command parameters.
src/m365/spo/commands/contenttype/contenttype-add.spec.ts Updates tests to use schema parsing and adds strict unknown-option test.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/m365/spo/commands/contenttype/contenttype-sync.ts
Comment thread src/m365/spo/commands/contenttype/contenttype-remove.ts
Comment thread src/m365/spo/commands/contenttype/contenttype-set.ts
Comment thread src/m365/spo/commands/contenttype/contenttype-get.ts
Comment thread src/m365/spo/commands/contenttype/contenttype-field-list.ts
@milanholemans
milanholemans marked this pull request as draft October 16, 2026 22:15
@milanholemans

Copy link
Copy Markdown
Contributor

Could you resolve the conflict?

@MartinM85
MartinM85 force-pushed the feature/7322-migrate-spo-contenttype-commands-to-zod branch from 7b63af9 to 6cb56a9 Compare October 17, 2026 08:29
@MartinM85
MartinM85 marked this pull request as ready for review October 17, 2026 08:56
@MartinM85

Copy link
Copy Markdown
Contributor Author

Could you resolve the conflict?

Resolved

This branch has not been deployed

No deployments
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 contenttype commands to Zod

3 participants