Skip to content

[http-client-csharp] Adopt Spector multiple-services scenario tests#10663

Open
JonathanCrd wants to merge 5 commits into
microsoft:mainfrom
JonathanCrd:adopt-spector-multiple-services
Open

[http-client-csharp] Adopt Spector multiple-services scenario tests#10663
JonathanCrd wants to merge 5 commits into
microsoft:mainfrom
JonathanCrd:adopt-spector-multiple-services

Conversation

@JonathanCrd
Copy link
Copy Markdown
Member

Fixes Azure/azure-sdk-for-net#58453


This pull request adds a new test project for handling multiple services in the C# HTTP client generator, along with all necessary configuration and references. It also updates the development dependency on @azure-tools/azure-http-specs to a newer version. The main focus is to introduce and test support for multiple service clients within the generated codebase.

Addition of Multiple Services Test Project:

  • Added a new test project for multiple services, including configuration, solution, and project files, as well as a comprehensive test suite in MultipleServicesTests.cs to verify correct operation of multiple service clients and their sub-namespaces. [1] [2] [3] [4] [5]
  • Registered the new multiple services test project as an allowed spec in the Spector helper script for test inclusion.
  • Added a project reference to the new multiple services library in the main Spector test project.

Dependency Updates:

  • Updated the @azure-tools/azure-http-specs development dependency from version 0.1.0-alpha.39 to 0.1.0-alpha.40-dev.12 in both package.json and package-lock.json, along with associated peer dependency and engine requirement changes. [1] [2] [3]

JonathanCrd and others added 3 commits May 12, 2026 16:15
- Update @azure-tools/azure-http-specs from 0.1.0-alpha.39 to
  0.1.0-alpha.40-dev.12 to include the new service/multiple-services spec
- Add service/multiple-services to the azure allow list in
  Spector-Helper.psm1 so the scenario is picked up during generation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Stubbed generation output for the service/multiple-services scenario,
which defines two separate services (ServiceA and ServiceB) in a single
TypeSpec file. The emitter correctly produces:
- ServiceAClient with AOperations and ASubNamespace sub-clients
- ServiceBClient with BOperations and BSubNamespace sub-clients

Generated via: eng/scripts/Generate.ps1 -filter http/service/multiple-services

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add MultipleServicesTests covering all 4 operations:
- ServiceA_OpA, ServiceA_SubOpA
- ServiceB_OpB, ServiceB_SubOpB

Tests are auto-skipped when code is stubbed. Verified all 4 pass with the
full (non-stubbed) generator against the Spector mock API.

Also adds the project reference to Spector.Tests.csproj.

Resolves: Azure/azure-sdk-for-net#58453

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JonathanCrd JonathanCrd self-assigned this May 13, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label May 13, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 13, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-csharp@10663

commit: 303167c

@github-actions
Copy link
Copy Markdown
Contributor

No changes needing a change description found.

Add the missing launch profile entry for the multiple-services scenario.
This file is auto-generated by Generate.ps1 when run without a filter.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JonathanCrd JonathanCrd changed the title [http-client-csharp] Adopt Spector multiple-services scenario [http-client-csharp] Adopt Spector multiple-services scenario tests May 13, 2026
@JonathanCrd JonathanCrd marked this pull request as ready for review May 13, 2026 17:50
@JoshLove-msft
Copy link
Copy Markdown
Contributor

No objections to including this in the unbranded test suite, but the actual issue was about including this for the Azure generator test suite.

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

Labels

emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adopt Spector Multiple-Services Scenario

2 participants