feat: migrate pp aibuildermodel, copilot, and dataverse commands to Zod#7424
Open
waldekmastykarz wants to merge 4 commits into
Open
feat: migrate pp aibuildermodel, copilot, and dataverse commands to Zod#7424waldekmastykarz wants to merge 4 commits into
waldekmastykarz wants to merge 4 commits into
Conversation
Migrates all 11 commands from the legacy #initOptions()/#initValidators()/ - pp aibuildermodel get - pp aibuildermodel list - pp aibuildermodel remove - pp copilot get - pp copilot list - pp copilot remove - pp dataverse table get - pp dataverse table list - pp dataverse table remove - pp dataverse table row list - pp dataverse table row remove Closes pnp#7313 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates the Power Platform pp aibuildermodel, pp copilot, and pp dataverse (table + table row) command set from legacy initOptions/initValidators/initTelemetry to Zod schema-based option definitions and cross-field validation, with corresponding test updates.
Changes:
- Introduced per-command exported
optionsZod schemas (usingz.strictObject+globalOptionsZod.shape) and wired them viaschema/getRefinedSchema(). - Replaced legacy option-set/validator logic with schema refinements (incl. GUID
.refine()and option-set.refine()). - Updated specs to validate via
commandInfo.command.getSchemaToParse()and added “unknown options” validation tests.
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/m365/pp/commands/aibuildermodel/aibuildermodel-get.ts | Defines Zod schema + option-set refinement for get by id/name. |
| src/m365/pp/commands/aibuildermodel/aibuildermodel-get.spec.ts | Updates validation/action tests to use schema parsing and adds unknown-option coverage. |
| src/m365/pp/commands/aibuildermodel/aibuildermodel-list.ts | Defines Zod schema for list command options. |
| src/m365/pp/commands/aibuildermodel/aibuildermodel-list.spec.ts | Updates tests to validate/parse via Zod schema and adds unknown-option coverage. |
| src/m365/pp/commands/aibuildermodel/aibuildermodel-remove.ts | Defines Zod schema + option-set refinement for remove by id/name. |
| src/m365/pp/commands/aibuildermodel/aibuildermodel-remove.spec.ts | Updates validation/action tests to use schema parsing and adds unknown-option coverage. |
| src/m365/pp/commands/copilot/copilot-get.ts | Defines Zod schema + option-set refinement for get by id/name. |
| src/m365/pp/commands/copilot/copilot-get.spec.ts | Updates validation/action tests to use schema parsing and adds unknown-option coverage. |
| src/m365/pp/commands/copilot/copilot-list.ts | Defines Zod schema for list command options. |
| src/m365/pp/commands/copilot/copilot-list.spec.ts | Updates tests to validate/parse via Zod schema and adds unknown-option coverage. |
| src/m365/pp/commands/copilot/copilot-remove.ts | Defines Zod schema + option-set refinement for remove by id/name. |
| src/m365/pp/commands/copilot/copilot-remove.spec.ts | Updates validation/action tests to use schema parsing and adds unknown-option coverage. |
| src/m365/pp/commands/dataverse/dataverse-table-get.ts | Defines Zod schema for table get options. |
| src/m365/pp/commands/dataverse/dataverse-table-get.spec.ts | Updates tests to validate/parse via Zod schema and adds unknown-option coverage. |
| src/m365/pp/commands/dataverse/dataverse-table-list.ts | Defines Zod schema for table list options. |
| src/m365/pp/commands/dataverse/dataverse-table-list.spec.ts | Updates tests to validate/parse via Zod schema and adds unknown-option coverage. |
| src/m365/pp/commands/dataverse/dataverse-table-remove.ts | Defines Zod schema for table remove options. |
| src/m365/pp/commands/dataverse/dataverse-table-remove.spec.ts | Updates tests to validate/parse via Zod schema and adds unknown-option coverage. |
| src/m365/pp/commands/dataverse/dataverse-table-row-list.ts | Defines Zod schema + option-set refinement (entitySetName/tableName). |
| src/m365/pp/commands/dataverse/dataverse-table-row-list.spec.ts | Updates tests to validate/parse via Zod schema and adds unknown-option coverage. |
| src/m365/pp/commands/dataverse/dataverse-table-row-remove.ts | Defines Zod schema + GUID validation + option-set refinement (entitySetName/tableName). |
| src/m365/pp/commands/dataverse/dataverse-table-row-remove.spec.ts | Updates tests to validate/parse via Zod schema and adds unknown-option coverage. |
| .impeccable/hook.cache.json | Adds a local tool cache artifact to the repo. |
Files not reviewed (1)
- .impeccable/hook.cache.json: Generated file
- Changed message: to error: in refine() calls to match repo convention - Removed .impeccable/hook.cache.json and added to .gitignore - Added negative tests for option set validation (both/neither specified) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove .impeccable/hook.cache.json from the repo - Fix .gitignore entry for .impeccable/ - Add negative tests for option set validation (both specified / neither specified) in: - copilot-get, copilot-remove - aibuildermodel-get, aibuildermodel-remove - dataverse-table-row-list, dataverse-table-row-remove Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The option set negative tests (both-specified / neither-specified) were already present from the Zod migration. A prior fix commit added exact duplicates; remove them to keep the specs clean. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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 all 11
pp aibuildermodel,pp copilot, andpp dataversecommands from the legacy#initOptions()/#initValidators()/#initTelemetry()pattern to Zod schema-based validation.Commands migrated:
pp aibuildermodel getpp aibuildermodel listpp aibuildermodel removepp copilot getpp copilot listpp copilot removepp dataverse table getpp dataverse table listpp dataverse table removepp dataverse table row listpp dataverse table row removeChanges per command:
GlobalOptionsinterface with exported Zodoptionsschema usingz.strictObject()schemagetter andgetRefinedSchema()for cross-field validation (option sets)#initTelemetry(),#initOptions(),#initValidators(),#initOptionSets()methods.refine()on the schemacommandOptionsSchema.safeParse()for validation tests andcommandOptionsSchema.parse()for action testsCloses #7313