Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paging ContinuationToken #2141

Open
4 of 13 tasks
lmazuel opened this issue Jan 28, 2025 · 2 comments
Open
4 of 13 tasks

Paging ContinuationToken #2141

lmazuel opened this issue Jan 28, 2025 · 2 comments

Comments

@lmazuel
Copy link
Member

lmazuel commented Jan 28, 2025

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.

Spec

Preview Give feedback
  1. lib:azure-http-specs
    msyyc
  2. docs lib:tcgc
    tadelesh
  3. lib:http-specs

Implementation

Preview Give feedback
  1. lib:tcgc
    tadelesh
  2. emitter:client:python
    msyyc
  3. emitter:client:java
    weidongxu-microsoft
  4. CodeGen HRLC p0
    MaryGao
  5. emitter:client:csharp
  6. CodeGen TypeSpec
  7. DPG
  8. HRLC P1 RLC
    MaryGao
@msyyc
Copy link
Member

msyyc commented Feb 18, 2025

@lmazuel, according to https://typespec.io/docs/standard-library/pagination/#_top:

Image

it is also valid scenario to pass token in payload. Shall we support it? If yes, there shall be more 2 spector scenarios:

  • Extract from JSON body, inject as payload parameter
  • Extract response header, inject as payload parameter

@msyyc
Copy link
Member

msyyc commented Feb 19, 2025

@lmazuel, according to https://typespec.io/docs/standard-library/pagination/#_top:

Image

it is also valid scenario to pass token in payload. Shall we support it? If yes, there shall be more 2 spector scenarios:

  • Extract from JSON body, inject as payload parameter
  • Extract response header, inject as payload parameter

Confirmed that continuation token in request body is not in scope : https://teams.microsoft.com/l/message/19:[email protected]/1739898764679?tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47&groupId=3e17dcb0-4257-4a30-b843-77f47f1d4121&parentMessageId=1739861699306&teamName=Azure%20SDK&channelName=TypeSpec%20Discussion&createdTime=1739898764679

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants