Migrate pa commands to Zod schema validation#7411
Draft
waldekmastykarz wants to merge 1 commit into
Draft
Conversation
Migrates the following commands to use Zod schemas: - pa app consent set - pa app export - pa app get - pa app list - pa app owner set - pa app permission ensure - pa app permission list - pa app permission remove - pa app remove - pa connector export - pa connector list Closes pnp#7310 Co-authored-by: Copilot <[email protected]>
MartinM85
requested changes
Jun 19, 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 🚀
Comment on lines
187
to
192
| options: { | ||
| environmentName: environmentName, | ||
| name: name, | ||
| bypass: true, | ||
| force: true | ||
| } |
Contributor
There was a problem hiding this comment.
Missing commandOptionsSchema.parse.
Suggested change
| options: commandOptionsSchema.parse({ | |
| environmentName: environmentName, | |
| name: name, | |
| bypass: true, | |
| force: true | |
| }) |
| } | ||
| }); | ||
|
|
||
| await assert.rejects(command.action(logger, { options: {} } as any), |
Contributor
There was a problem hiding this comment.
Suggested change
| await assert.rejects(command.action(logger, { options: commandOptionsSchema.parse({}) }), |
| } | ||
| }); | ||
|
|
||
| await assert.rejects(command.action(logger, { options: { environmentName: validEnvironmentName, appName: validAppName, userId: validUserId } } as any), |
Contributor
There was a problem hiding this comment.
Suggested change
| await assert.rejects(command.action(logger, { options: commandOptionsSchema.parse({ environmentName: validEnvironmentName, appName: validAppName, userId: validUserId }) }), |
| } | ||
| }); | ||
|
|
||
| await assert.rejects(command.action(logger, { options: { name: '3989cb59-ce1a-4a5c-bb78-257c5c39381d' } } as any), |
Contributor
There was a problem hiding this comment.
Suggested change
| await assert.rejects(command.action(logger, { options: commandOptionsSchema.parse({ name: '3989cb59-ce1a-4a5c-bb78-257c5c39381d' }) }), |
Comment on lines
737
to
741
| options: { | ||
| verbose: true, | ||
| displayName: 'Playwright' | ||
| } | ||
| } as any), new CommandError('No apps found.')); |
Contributor
There was a problem hiding this comment.
Suggested change
| options: commandOptionsSchema.parse({ | |
| verbose: true, | |
| displayName: 'Playwright' | |
| }) | |
| }), new CommandError('No apps found.')); |
Comment on lines
721
to
725
| options: { | ||
| verbose: true, | ||
| displayName: 'NoAppFound' | ||
| } | ||
| } as any), new CommandError(`No app found with displayName 'NoAppFound'.`)); |
Contributor
There was a problem hiding this comment.
Suggested change
| options: commandOptionsSchema.parse({ | |
| verbose: true, | |
| displayName: 'NoAppFound' | |
| }) | |
| }), new CommandError(`No app found with displayName 'NoAppFound'.`)); |
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.
What's in this PR
Migrates all
pacommands from the legacy#initOptions()/#initValidators()/#initTelemetry()pattern to Zod schema-based validation.Commands migrated
pa app consent setpa app exportpa app getpa app listpa app owner setpa app permission ensurepa app permission listpa app permission removepa app removepa connector exportpa connector listChanges per command
#initOptions(),#initValidators(),#initTelemetry(),#initTypes(),#initOptionSets()with exportedoptionsZod schemaschemagetter andgetRefinedSchema()for cross-field validationcommandOptionsSchema.safeParse()for validation tests andcommandOptionsSchema.parse()for action testsCloses #7310