Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The .positive() validator rejects the documented first-page value --pageNumber 0; it should allow zero and include a regression test.
1 open issue
What changed in this PR
Migrates the 24 spo listitem commands to the CLI’s Zod-based validation model, addressing #7334 as part of the broader migration in #6807.
Changes:
- Replaces legacy option registration, validators, and telemetry setup with exported schemas and cross-option refinements.
- Updates tests to parse options through schemas and check validation errors.
- Adapts tenant extension commands to the inferred output-option type.
| File | Description |
|---|---|
src/m365/spo/commands/tenant/tenant-commandset-add.ts |
Narrows output values passed to list-item creation. |
src/m365/spo/commands/tenant/tenant-commandset-add.spec.ts |
Exercises the none output option. |
src/m365/spo/commands/tenant/tenant-applicationcustomizer-add.ts |
Narrows output values passed to list-item creation. |
src/m365/spo/commands/tenant/tenant-applicationcustomizer-add.spec.ts |
Exercises the none output option. |
src/m365/spo/commands/listitem/listitem-set.ts |
Adds a schema preserving arbitrary field options. |
src/m365/spo/commands/listitem/listitem-roleinheritance-reset.ts |
Migrates inheritance-reset validation to Zod. |
src/m365/spo/commands/listitem/listitem-roleinheritance-reset.spec.ts |
Uses schema validation in reset tests. |
src/m365/spo/commands/listitem/listitem-roleinheritance-break.ts |
Migrates inheritance-break validation to Zod. |
src/m365/spo/commands/listitem/listitem-roleinheritance-break.spec.ts |
Uses schema validation in inheritance-break tests. |
src/m365/spo/commands/listitem/listitem-roleassignment-remove.ts |
Adds list and principal selection refinements. |
src/m365/spo/commands/listitem/listitem-roleassignment-add.ts |
Adds list, principal, and role selection refinements. |
src/m365/spo/commands/listitem/listitem-retentionlabel-remove.ts |
Adds a schema and passes numeric item IDs directly. |
src/m365/spo/commands/listitem/listitem-retentionlabel-remove.spec.ts |
Updates removal tests for schema parsing. |
src/m365/spo/commands/listitem/listitem-retentionlabel-ensure.ts |
Adds label-selection validation and numeric item IDs. |
src/m365/spo/commands/listitem/listitem-remove.ts |
Migrates deletion options and validation to Zod. |
src/m365/spo/commands/listitem/listitem-remove.spec.ts |
Updates validation tests and corrects action inputs. |
src/m365/spo/commands/listitem/listitem-record-unlock.ts |
Adds record-unlock schema validation. |
src/m365/spo/commands/listitem/listitem-record-unlock.spec.ts |
Parses unlock inputs and tests unknown options. |
src/m365/spo/commands/listitem/listitem-record-undeclare.ts |
Adds record-undeclaration schema validation. |
src/m365/spo/commands/listitem/listitem-record-undeclare.spec.ts |
Migrates tests and corrects the item-ID option. |
src/m365/spo/commands/listitem/listitem-record-lock.ts |
Adds record-lock schema validation. |
src/m365/spo/commands/listitem/listitem-record-lock.spec.ts |
Parses lock inputs and tests unknown options. |
src/m365/spo/commands/listitem/listitem-record-declare.ts |
Adds date validation and numeric item-ID typing. |
src/m365/spo/commands/listitem/listitem-list.ts |
Adds pagination and query-option schema constraints. |
src/m365/spo/commands/listitem/listitem-isrecord.ts |
Adds a schema and numeric request-body ID typing. |
src/m365/spo/commands/listitem/listitem-isrecord.spec.ts |
Migrates record-status tests to schema parsing. |
src/m365/spo/commands/listitem/listitem-get.ts |
Adds list and item identifier selection refinements. |
src/m365/spo/commands/listitem/listitem-batch-set.ts |
Adds file-path and batch-update option validation. |
src/m365/spo/commands/listitem/listitem-batch-set.spec.ts |
Updates schema tests and file-existence stubs. |
src/m365/spo/commands/listitem/listitem-batch-remove.ts |
Moves CSV and ID validation into schema refinements. |
src/m365/spo/commands/listitem/listitem-batch-add.ts |
Adds list and CSV-source selection refinements. |
src/m365/spo/commands/listitem/listitem-batch-add.spec.ts |
Tests schema parsing and CSV-source exclusivity. |
src/m365/spo/commands/listitem/listitem-attachment-set.ts |
Adds attachment-update schema and file validation. |
src/m365/spo/commands/listitem/listitem-attachment-set.spec.ts |
Migrates tests and corrects the GUID fixture. |
src/m365/spo/commands/listitem/listitem-attachment-remove.ts |
Adds attachment-removal schema validation. |
src/m365/spo/commands/listitem/listitem-attachment-remove.spec.ts |
Parses removal inputs and tests unknown options. |
src/m365/spo/commands/listitem/listitem-attachment-list.ts |
Adds attachment-list schema validation. |
src/m365/spo/commands/listitem/listitem-attachment-list.spec.ts |
Migrates list-selection and action tests. |
src/m365/spo/commands/listitem/listitem-attachment-get.ts |
Adds attachment-retrieval schema validation. |
src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts |
Migrates retrieval and validation tests. |
src/m365/spo/commands/listitem/listitem-attachment-add.ts |
Adds attachment-creation schema and file validation. |
src/m365/spo/commands/listitem/listitem-attachment-add.spec.ts |
Migrates tests and corrects the GUID fixture. |
src/m365/spo/commands/listitem/listitem-add.ts |
Adds a schema preserving arbitrary field options. |
src/m365/spo/commands/listitem/listitem-add.spec.ts |
Migrates creation tests while retaining custom fields. |
Review effort: Balanced
| listTitle: z.string().optional().alias('t'), | ||
| listUrl: z.string().optional(), | ||
| pageSize: z.number().int().positive().optional().alias('s'), | ||
| pageNumber: z.number().int().positive().optional().alias('n'), |
This branch has not been deployed
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.

Closes #7334