feat: add warning when @list has no paging navigation information - #11475
feat: add warning when @list has no paging navigation information#11475timotheeguerin with Copilot wants to merge 4 commits into
@list has no paging navigation information#11475Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
…ation" Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
@list has no paging navigation information
commit: |
|
@copilot build is failing with |
…igation, add @offset to nav check, fix Page<T> model Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Fixed in the latest commit. There were three issues:
|
|
@copilot still failures, DO a full build and test before finishing FAIL @typespec/samples test/samples.test.ts [ packages/samples/test/samples.test.ts ] simple ❯ src/sample-snapshot-testing.ts:73:9 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/4]⎯ ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 2 ⎯⎯⎯⎯⎯⎯⎯ FAIL @typespec/samples test/samples.test.ts > todoApp simple ❯ expectDiagnosticEmpty ../compiler/src/testing/expect.ts:14:5 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/4]⎯ Start at 13:49:06 Error: AssertionError: The following snapshot are still present in the output dir but were not generated: simple ❯ src/sample-snapshot-testing.ts:73:9 Error: AssertionError: Unexpected diagnostics: simple ❯ expectDiagnosticEmpty ../compiler/src/testing/expect.ts:14:5 Error: AssertionError: The following snapshot are still present in the output dir but were not generated: simple ❯ src/sample-snapshot-testing.ts:73:9 Error: AssertionError: Unexpected diagnostics: simple ❯ expectDiagnosticEmpty ../compiler/src/testing/expect.ts:14:5 |
…doApp The `Page<T>` generic model in packages/samples/specs/todoApp/main.tsp was missing a navigation property, causing the new `list-no-paging-navigation` warning to fire on the `Attachments.list` operation. Added `@nextLink nextLink?: url` to the model, and updated the corresponding OpenAPI snapshot to include the new `nextLink` field in the `Attachments_list` response schema. Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
... Fixed in the latest commit ( The root cause was that |
@listoperations with@pageItemsbut no way to navigate pages emitted no diagnostic, making it easy to accidentally define incomplete paged operations.Changes
list-no-paging-navigation(packages/compiler/src/core/messages.ts) — fired when a@listoperation lacks all three navigation mechanisms:@nextLink,@pageIndex, and@continuationToken.packages/compiler/src/lib/paging.ts) — added check ingetPagingOperationafter the@pageItemsguard; emits the warning if none of the required navigation properties are present in input or output.packages/compiler/test/decorators/paging.test.ts) — added 4 targeted tests for the new warning; updated existing tests to include navigation decorators where they were missing.Example
@listis used with no paging information #7859