Migrate purview retentionevent and retentioneventtype commands to Zod#7420
Open
waldekmastykarz wants to merge 4 commits into
Open
Migrate purview retentionevent and retentioneventtype commands to Zod#7420waldekmastykarz wants to merge 4 commits into
waldekmastykarz wants to merge 4 commits into
Conversation
Migrates the following commands from the legacy #initOptions()/#initValidators()/#initTelemetry() pattern to Zod schema-based validation: - purview retentionevent add - purview retentionevent get - purview retentionevent remove - purview retentioneventtype add - purview retentioneventtype get - purview retentioneventtype remove - purview retentioneventtype set Closes pnp#7315 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the Purview retentionevent and retentioneventtype command set from legacy option/validator/telemetry initialization to the CLI’s Zod schema-based option parsing and validation model.
Changes:
- Replaced legacy
#initOptions()/#initValidators()/#initTelemetry()patterns withschemagetters and Zod option schemas. - Introduced
getRefinedSchema()where cross-option validation is required (option sets / “required” refinements). - Updated unit tests to validate via
command.getSchemaToParse()(safeParse/parse) and added “unknown options” validation cases.
Reviewed changes
Copilot reviewed 14 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/m365/purview/commands/retentioneventtype/retentioneventtype-add.ts | Migrates retentioneventtype add options to Zod schema. |
| src/m365/purview/commands/retentioneventtype/retentioneventtype-add.spec.ts | Updates tests to use schema parsing and adds unknown-option validation coverage. |
| src/m365/purview/commands/retentioneventtype/retentioneventtype-get.ts | Migrates retentioneventtype get options/validation to Zod schema. |
| src/m365/purview/commands/retentioneventtype/retentioneventtype-get.spec.ts | Updates tests to schema-based validation/parsing and adds unknown-option test. |
| src/m365/purview/commands/retentioneventtype/retentioneventtype-remove.ts | Migrates retentioneventtype remove options/validation to Zod schema. |
| src/m365/purview/commands/retentioneventtype/retentioneventtype-remove.spec.ts | Updates tests to schema-based validation/parsing and adds unknown-option test. |
| src/m365/purview/commands/retentioneventtype/retentioneventtype-set.ts | Migrates retentioneventtype set to Zod schema and adds refined validation. |
| src/m365/purview/commands/retentioneventtype/retentioneventtype-set.spec.ts | Updates tests to schema-based validation/parsing and adds unknown-option test. |
| src/m365/purview/commands/retentionevent/retentionevent-add.ts | Migrates retentionevent add to Zod schema and adds refined cross-field validation. |
| src/m365/purview/commands/retentionevent/retentionevent-add.spec.ts | Updates tests to schema-based validation/parsing and adds unknown-option test. |
| src/m365/purview/commands/retentionevent/retentionevent-get.ts | Migrates retentionevent get options/validation to Zod schema. |
| src/m365/purview/commands/retentionevent/retentionevent-get.spec.ts | Updates tests to schema-based validation/parsing and adds unknown-option test. |
| src/m365/purview/commands/retentionevent/retentionevent-remove.ts | Migrates retentionevent remove options/validation to Zod schema and updates internal typing. |
| src/m365/purview/commands/retentionevent/retentionevent-remove.spec.ts | Updates tests to schema-based validation/parsing and adds unknown-option test. |
| npm-shrinkwrap.json | Lockfile changes included alongside command migration. |
| .impeccable/hook.cache.json | Adds a tool cache file with developer-local paths. |
Files not reviewed (2)
- .impeccable/hook.cache.json: Generated file
- npm-shrinkwrap.json: Generated file
- Added path to refine params for customCode required - Changed message: to error: in refine calls - Removed .impeccable/hook.cache.json and added to .gitignore - Reverted unintentional npm-shrinkwrap.json changes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
MartinM85
requested changes
Jun 27, 2026
MartinM85
left a comment
Contributor
There was a problem hiding this comment.
I have a couple of small comments, nothing major. Great work @waldekmastykarz 🚀
- Put .impeccable/ on its own line in .gitignore - Remove tracked .impeccable/hook.cache.json - Reset npm-shrinkwrap.json to upstream main Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
MartinM85
reviewed
Jul 2, 2026
…vert npm-shrinkwrap - Update retentioneventtype-set and retentionevent-add refines to use customCode: 'optionSet' with params.options so prompting works without a path - Revert npm-shrinkwrap.json to match the branch's package.json (merge-base) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
MartinM85
approved these changes
Jul 3, 2026
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.
Summary
Migrates the following commands from the legacy
#initOptions()/#initValidators()/#initTelemetry()pattern to Zod schema-based validation:purview retentionevent addpurview retentionevent getpurview retentionevent removepurview retentioneventtype addpurview retentioneventtype getpurview retentioneventtype removepurview retentioneventtype setChanges
#initOptions(),#initValidators(),#initTelemetry(),#initOptionSets()methods and constructors with Zod schemasschemagetter andgetRefinedSchema()where cross-field validation is neededcommandOptionsSchema.safeParse()for validation tests andcommandOptionsSchema.parse()for action testsCloses #7315