Azure / Azure/typespec-azure

Paging ContinuationToken

Open
#2,141 2 comments 0 reactions 0 assignees View on GitHub
epic needs-area
Dominant language
TypeScript
Stars
27
Forks
90
Avg merge
1d 22h
Merged PRs (30d)
156

Description

Support the continuation token paging feature of TypeSpec. This applies to unbranded, but there is no reason to make make it work for Azure (Storage needs it if one day we do storage).

Doc from TypeSpec:
https://typespec.io/docs/standard-library/pagination/#example-1-using-continuation-token

The concept is that this decorator is used twice:
- Once in the response
- Once in the operation that act as next operation

Codegen must do the link between those two, and then:
- Use the page1 url as base url
- Add continuation token extracted from the response.

We will limit ourselves to:
- Extraction from response header and response body (JSON path)
- Injection as header parameter and query parameter

Which means we should have at least 4 spector scenarios:
- Extract from JSON body, inject as query parameter
- Extract from JSON body, inject as header parameter
- Extract response header, inject as query parameter
- Extract response header, inject as header parameter

Note that if the initial operation had optional query parameters that were passed, they stay in the url used for the next page. IOW, whatever url was used for page 1, is the one used as basis for building the next HTTP request.

```[tasklist]
### Spec
- [ ] https://github.com/Azure/typespec-azure/issues/2140
- [ ] https://github.com/Azure/typespec-azure/issues/2138
- [ ] https://github.com/microsoft/typespec/issues/6060
```

```[tasklist]
### Implementation
- [ ] https://github.com/Azure/typespec-azure/issues/2139
- [ ] https://github.com/microsoft/typespec/issues/5791
- [ ] https://github.com/microsoft/typespec/issues/5792
- [ ] https://github.com/Azure/autorest.typescript/issues/3041
- [ ] https://github.com/microsoft/typespec/issues/5793
- [ ] https://github.com/Azure/autorest.go/issues/1494
- [ ] https://github.com/Azure/autorest.cpp/issues/485
- [ ] https://github.com/Azure/typespec-rust/issues/236
- [ ] https://github.com/Azure/autorest.java/issues/3026
- [ ] https://github.com/Azure/typespec-azure/issues/4769
```

Contributor guide

Open the contributing guide

Research direction

Start with the linked TypeSpec pagination documentation and prerequisite issues 2140, 2138, and microsoft/typespec#6060. Review the implementation links, then define Spector scenarios for the four extraction and injection combinations. Done means continuation-token paging preserves the page-one URL and supports the stated response and request locations.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.