Skip to content

Add test scenario for relative nextLink URLs in pagination#3922

Merged
JoshLove-msft merged 4 commits intomainfrom
copilot/add-spector-scenario-nextlink
Feb 11, 2026
Merged

Add test scenario for relative nextLink URLs in pagination#3922
JoshLove-msft merged 4 commits intomainfrom
copilot/add-spector-scenario-nextlink

Conversation

Copy link
Contributor

Copilot AI commented Feb 10, 2026

Some Azure services return relative URLs in pagination nextLink fields instead of absolute URLs. Clients must resolve these against the service endpoint.

Changes

  • New scenario: Azure_Core_Page_withRelativeNextLink in azure/core/page
    • Tests two-page pagination where nextLink is a relative path
    • Route: GET /azure/core/page/with-relative-next-link

Technical Detail

Mock API returns relative URL without base URL injection:

// Relative nextLink (new)
nextLink: dyn`/azure/core/page/with-relative-next-link/page/2`

// vs absolute nextLink (existing scenarios)
nextLink: dyn`${dynItem("baseUrl")}/azure/core/page/items/page/2`

Clients must prepend the service endpoint to relative URLs when following pagination.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add spector scenario for relative nextlink</issue_title>
<issue_description>Some Azure services don't use an absolute URL for the nextlink. If a relative URL is used, the endpoint needs to be reset in subsequent requests.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 10, 2026 22:13
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Copilot AI changed the title [WIP] Add spector scenario for relative nextlink Add test scenario for relative nextLink URLs in pagination Feb 10, 2026
Copilot AI requested a review from JoshLove-msft February 10, 2026 22:20
@JoshLove-msft JoshLove-msft marked this pull request as ready for review February 10, 2026 22:28
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 10, 2026

Open in StackBlitz

npm i https://pkg.pr.new/Azure/typespec-azure/@azure-tools/azure-http-specs@3922

commit: f116188

Copy link
Member

@lmazuel lmazuel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not an expert in writing scenario tests, but conceptually this looks all good

@azure-sdk
Copy link
Collaborator

All changed packages have been documented.

  • @azure-tools/azure-http-specs
Show changes

@azure-tools/azure-http-specs - feature ✏️

Add test scenario for relative nextLink URLs in pagination. Some Azure services use relative URLs instead of absolute URLs for pagination nextLink, requiring clients to resolve them against the service endpoint.

@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website

@JoshLove-msft JoshLove-msft added this pull request to the merge queue Feb 10, 2026
Merged via the queue into main with commit 66469fa Feb 11, 2026
28 checks passed
@JoshLove-msft JoshLove-msft deleted the copilot/add-spector-scenario-nextlink branch February 11, 2026 00:18
github-merge-queue bot pushed a commit to microsoft/typespec that referenced this pull request Feb 13, 2026
…tLink scenario (#9685)

Adds Python SDK test coverage for the new
`Azure_Core_Page_withRelativeNextLink` Spector scenario from
[Azure/typespec-azure#3922](Azure/typespec-azure#3922),
which tests pagination with relative nextLink URLs that clients must
resolve against the service endpoint.

- **Dependency bump**: `@azure-tools/azure-http-specs` →
`0.1.0-alpha.38-dev.2` to pick up the new scenario
- **Sync test**: `test_list_with_relative_next_link` in
`test_azure_core_page.py`
- **Async test**: `test_list_with_relative_next_link` in
`test_azure_core_page_async.py`
- **Changelog**: internal change entry for
`@typespec/http-client-python`

Both tests paginate across two pages and assert `id`, `name`, and `etag`
for each returned `User`:

```python
def test_list_with_relative_next_link(client: PageClient):
    result = list(client.with_relative_next_link())
    assert len(result) == 2
    assert result[0].id == 1
    assert result[0].name == "User1"
    assert result[1].id == 2
    assert result[1].name == "User2"
```

> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `https://api.github.com/repos/Azure/typespec-azure/pulls/3922`
> - Triggering command:
`/home/REDACTED/work/_temp/ghcca-node/node/bin/node
/home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps
/home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js`
(http block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/microsoft/typespec/settings/copilot/coding_agent)
(admins only)
>
> </details>

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com>
@timotheeguerin timotheeguerin added the lib:azure-http-specs For issues/prs related to the @azure-tools/typespec-azure-http-specs package label Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib:azure-http-specs For issues/prs related to the @azure-tools/typespec-azure-http-specs package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add spector scenario for relative nextlink

5 participants