Skip to content

Commit

Permalink
Update CollectionWithNextLink to support pagination (#5685)
Browse files Browse the repository at this point in the history
Fixes #5491

---------

Co-authored-by: Christopher Radek <[email protected]>
Co-authored-by: Timothee Guerin <[email protected]>
  • Loading branch information
3 people authored Jan 21, 2025
1 parent 55481b8 commit 38ccfe1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 7 additions & 0 deletions .chronus/changes/collection-is-pageable-2025-0-21-10-53-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: feature
packages:
- "@typespec/rest"
---

Updates `CollectionWithNextLink` to support pagination
5 changes: 2 additions & 3 deletions packages/rest/lib/resource.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,17 @@ interface ResourceDelete<Resource extends {}, Error> {
/**
* Structure for a paging response using `value` and `nextLink` to represent pagination.
*
* This only provides the model structure and not actual pagination support. See
* https://github.com/microsoft/typespec/issues/705 for general paging support.
*
* @template Resource The resource type of the collection.
*/
@doc("Paged response of {name} items", Resource)
@friendlyName("{name}CollectionWithNextLink", Resource)
model CollectionWithNextLink<Resource extends {}> {
@doc("The items on this page")
@pageItems
value: Resource[];

@doc("The link to the next page of items")
@nextLink
nextLink?: ResourceLocation<Resource>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ scalar TypeSpec.Rest.ResourceLocation

Structure for a paging response using `value` and `nextLink` to represent pagination.

This only provides the model structure and not actual pagination support. See
https://github.com/microsoft/typespec/issues/705 for general paging support.

```typespec
model TypeSpec.Rest.Resource.CollectionWithNextLink<Resource>
```
Expand Down

0 comments on commit 38ccfe1

Please sign in to comment.