diff --git a/packages/http-client-csharp/eng/scripts/Generate.ps1 b/packages/http-client-csharp/eng/scripts/Generate.ps1
index 2c0f1418ee..61f540fbdc 100644
--- a/packages/http-client-csharp/eng/scripts/Generate.ps1
+++ b/packages/http-client-csharp/eng/scripts/Generate.ps1
@@ -50,7 +50,6 @@ function IsSpecDir {
$failingSpecs = @(
Join-Path 'http' 'payload' 'pageable'
- Join-Path 'http' 'resiliency' 'srv-driven'
Join-Path 'http' 'special-headers' 'conditional-request'
Join-Path 'http' 'type' 'model' 'flatten'
Join-Path 'http' 'type' 'model' 'templated'
@@ -94,7 +93,7 @@ foreach ($directory in $directories) {
$generationDir = Join-Path $generationDir $folder
}
- #create the directory if it doesn't exist
+ # create the directory if it doesn't exist
if (-not (Test-Path $generationDir)) {
New-Item -ItemType Directory -Path $generationDir | Out-Null
}
@@ -111,6 +110,24 @@ foreach ($directory in $directories) {
exit $LASTEXITCODE
}
+ # srv-driven contains two separate specs, for two separate clients. We need to generate both.
+ if ($folders.Contains("srv-driven")) {
+ $specFile = Join-Path $directory.FullName "old.tsp"
+ $generationDir = Join-Path $generationDir "v1"
+ if (-not (Test-Path $generationDir)) {
+ New-Item -ItemType Directory -Path $generationDir | Out-Null
+ }
+
+ Write-Host "Generating $subPath v1" -ForegroundColor Cyan
+ # override namespace for "resiliency/srv-driven/old.tsp" (make it different to that from "main.tsp")
+ Invoke (Get-TspCommand $specFile $generationDir $stubbed " --option @typespec/http-client-csharp.namespace=Resiliency.ServiceDriven.V1")
+
+ # exit if the generation failed
+ if ($LASTEXITCODE -ne 0) {
+ exit $LASTEXITCODE
+ }
+ }
+
# TODO need to build but depends on https://github.com/Azure/autorest.csharp/issues/4463
}
diff --git a/packages/http-client-csharp/eng/scripts/Generation.psm1 b/packages/http-client-csharp/eng/scripts/Generation.psm1
index 626bb6c7a8..997541ae00 100644
--- a/packages/http-client-csharp/eng/scripts/Generation.psm1
+++ b/packages/http-client-csharp/eng/scripts/Generation.psm1
@@ -24,7 +24,8 @@ function Get-TspCommand {
param (
[string]$specFile,
[string]$generationDir,
- [bool]$generateStub = $false
+ [bool]$generateStub = $false,
+ [string[]]$additionalOptions = @()
)
$command = "npx tsp compile $specFile"
$command += " --trace @typespec/http-client-csharp"
@@ -38,6 +39,10 @@ function Get-TspCommand {
if ($generateStub) {
$command += " --option @typespec/http-client-csharp.plugin-name=StubLibraryPlugin"
}
+
+ foreach ($option in $additionalOptions) {
+ $command += " $option"
+ }
return $command
}
diff --git a/packages/http-client-csharp/eng/scripts/Get-CadlRanch-Coverage.ps1 b/packages/http-client-csharp/eng/scripts/Get-CadlRanch-Coverage.ps1
index 441bb93a12..f6fb019d5a 100644
--- a/packages/http-client-csharp/eng/scripts/Get-CadlRanch-Coverage.ps1
+++ b/packages/http-client-csharp/eng/scripts/Get-CadlRanch-Coverage.ps1
@@ -27,6 +27,10 @@ foreach ($directory in $directories) {
$outputDir = $directory.FullName.Substring(0, $directory.FullName.IndexOf("src") - 1)
$subPath = $outputDir.Substring($cadlRanchRoot.Length + 1)
+ if ($subPath.Contains($(Join-Path 'srv-driven' 'v1'))) {
+ continue
+ }
+
Write-Host "Regenerating $subPath" -ForegroundColor Cyan
$specFile = Join-Path $specsDirectory $subPath "client.tsp"
@@ -40,6 +44,21 @@ foreach ($directory in $directories) {
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
+
+ # srv-driven contains two separate specs, for two separate clients. We need to generate both.
+ if ($subPath.Contains('srv-driven')) {
+ Write-Host "Regenerating $subPath v1" -ForegroundColor Cyan
+ $specFile = Join-Path $specsDirectory $subPath "old.tsp"
+ $outputDir = Join-Path $outputDir "v1"
+ # override namespace for "resiliency/srv-driven/old.tsp" (make it different to that from "main.tsp")
+ $command = Get-TspCommand $specFile $outputDir -additionalOptions " --option @typespec/http-client-csharp.namespace=Resiliency.ServiceDriven.V1"
+
+ Invoke $command
+ # exit if the generation failed
+ if ($LASTEXITCODE -ne 0) {
+ exit $LASTEXITCODE
+ }
+ }
}
# test all
diff --git a/packages/http-client-csharp/eng/scripts/Test-CadlRanch.ps1 b/packages/http-client-csharp/eng/scripts/Test-CadlRanch.ps1
index 4f2a3eaa64..efb3e20cad 100644
--- a/packages/http-client-csharp/eng/scripts/Test-CadlRanch.ps1
+++ b/packages/http-client-csharp/eng/scripts/Test-CadlRanch.ps1
@@ -32,6 +32,10 @@ foreach ($directory in $directories) {
if (-not (Compare-Paths $subPath $filter)) {
continue
}
+
+ if ($subPath.Contains($(Join-Path 'srv-driven' 'v1'))) {
+ continue
+ }
$testPath = "$cadlRanchRoot.Tests"
$testFilter = "TestProjects.CadlRanch.Tests"
@@ -64,6 +68,22 @@ foreach ($directory in $directories) {
exit $LASTEXITCODE
}
+ # srv-driven contains two separate specs, for two separate clients. We need to generate both.
+ if ($subPath.Contains("srv-driven")) {
+ Write-Host "Regenerating $subPath v1" -ForegroundColor Cyan
+
+ $specFile = Join-Path $specsDirectory $subPath "old.tsp"
+ $srvDrivenOutputDir = Join-Path $outputDir "v1"
+ # override namespace for "resiliency/srv-driven/old.tsp" (make it different to that from "main.tsp")
+ $command = Get-TspCommand $specFile $srvDrivenOutputDir -additionalOptions " --option @typespec/http-client-csharp.namespace=Resiliency.ServiceDriven.V1"
+ Invoke $command
+
+ if ($LASTEXITCODE -ne 0) {
+ exit $LASTEXITCODE
+ }
+ }
+
+
Write-Host "Testing $subPath" -ForegroundColor Cyan
$command = "dotnet test $cadlRanchCsproj --filter `"FullyQualifiedName~$testFilter`""
Invoke $command
diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Properties/launchSettings.json b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Properties/launchSettings.json
index 6a46a890e6..a813937b29 100644
--- a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Properties/launchSettings.json
+++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Properties/launchSettings.json
@@ -120,6 +120,11 @@
"commandName": "Executable",
"executablePath": "$(SolutionDir)/../dist/generator/Microsoft.Generator.CSharp.exe"
},
+ "http-resiliency-srv-driven": {
+ "commandLineArgs": "$(SolutionDir)/TestProjects/CadlRanch/http/resiliency/srv-driven -p StubLibraryPlugin",
+ "commandName": "Executable",
+ "executablePath": "$(SolutionDir)/../dist/generator/Microsoft.Generator.CSharp.exe"
+ },
"http-routes": {
"commandLineArgs": "$(SolutionDir)/TestProjects/CadlRanch/http/routes -p StubLibraryPlugin",
"commandName": "Executable",
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/Resiliency/SrvDriven/SrvDrivenTests.V1.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/Resiliency/SrvDriven/SrvDrivenTests.V1.cs
new file mode 100644
index 0000000000..98a1e96e24
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/Resiliency/SrvDriven/SrvDrivenTests.V1.cs
@@ -0,0 +1,77 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using NUnit.Framework;
+using Resiliency.ServiceDriven.V1;
+using System.Threading.Tasks;
+
+namespace TestProjects.CadlRanch.Tests.Http.Resiliency.SrvDriven
+{
+ ///
+ /// Contains tests for the service-driven resiliency V1 client.
+ ///
+ public partial class SrvDrivenTests : CadlRanchTestBase
+ {
+ // This test validates the v1 client behavior when both the service deployment and api version are set to V1.
+ [CadlRanchTest]
+ public Task AddOptionalParamFromNone_V1Client_V1Service_WithApiVersionV1() => Test(async (host) =>
+ {
+ var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1);
+ var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV1, options);
+ var response = await client.FromNoneAsync();
+
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ // This test validates the v1 client behavior when the service deployment is set to V2 and the api version is set to V1.
+ [CadlRanchTest]
+ public Task AddOptionalParamFromNone_V1Client_V2Service_WithApiVersionV1() => Test(async (host) =>
+ {
+ var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1);
+ var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options);
+ var response = await client.FromNoneAsync();
+
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task AddOptionalParamFromOneOptional_V1Client_V1Service_WithApiVersionV1() => Test(async (host) =>
+ {
+ var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1);
+ var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV1, options);
+ var response = await client.FromOneOptionalAsync("optional");
+
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task AddOptionalParamFromOneOptional_V1Client_V2Service_WithApiVersionV1() => Test(async (host) =>
+ {
+ var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1);
+ var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options);
+ var response = await client.FromOneOptionalAsync("optional");
+
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task AddOptionalParamFromOneRequired_V1Client_V1Service_WithApiVersionV1() => Test(async (host) =>
+ {
+ var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1);
+ var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV1, options);
+ var response = await client.FromOneRequiredAsync("required");
+
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task AddOptionalParamFromOneRequired_V1Client_V2Service_WithApiVersionV1() => Test(async (host) =>
+ {
+ var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1);
+ var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options);
+ var response = await client.FromOneRequiredAsync("required");
+
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/Resiliency/SrvDriven/SrvDrivenTests.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/Resiliency/SrvDriven/SrvDrivenTests.cs
new file mode 100644
index 0000000000..68a8e95e7a
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/Resiliency/SrvDriven/SrvDrivenTests.cs
@@ -0,0 +1,86 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using NUnit.Framework;
+using System.Threading.Tasks;
+using Resiliency.ServiceDriven;
+
+namespace TestProjects.CadlRanch.Tests.Http.Resiliency.SrvDriven
+{
+ public partial class SrvDrivenTests : CadlRanchTestBase
+ {
+ private const string ServiceDeploymentV1 = "v1";
+ private const string ServiceDeploymentV2 = "v2";
+
+ [CadlRanchTest]
+ public Task AddOperation() => Test(async (host) =>
+ {
+ var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2);
+ var response = await client.AddOperationAsync();
+
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ // This test validates the "new" client behavior when the api version is set to V1.
+ [CadlRanchTest]
+ public Task AddOptionalParamFromNone_WithApiVersionV1() => Test(async (host) =>
+ {
+ var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1);
+ var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options);
+ var response = await client.FromNoneAsync();
+
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ // This test validates the "new" client behavior when the api version is set to V2.
+ [CadlRanchTest]
+ public Task AddOptionalParamFromNone_WithApiVersionV2() => Test(async (host) =>
+ {
+ var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V2);
+ var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options);
+ var response = await client.FromNoneAsync("new");
+
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task AddOptionalParamFromOneOptional_WithApiVersionV1() => Test(async (host) =>
+ {
+ var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1);
+ var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options);
+ var response = await client.FromOneOptionalAsync("optional");
+
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task AddOptionalParamFromOneOptional_WithApiVersionV2() => Test(async (host) =>
+ {
+ var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V2);
+ var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options);
+ var response = await client.FromOneOptionalAsync("optional", "new");
+
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task AddOptionalParamFromOneRequired_WithApiVersionV1() => Test(async (host) =>
+ {
+ var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1);
+ var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options);
+ var response = await client.FromOneRequiredAsync("required");
+
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task AddOptionalParamFromOneRequired_WithApiVersionV2() => Test(async (host) =>
+ {
+ var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V2);
+ var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options);
+ var response = await client.FromOneRequiredAsync("required", "new");
+
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/Configuration.json b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/Configuration.json
new file mode 100644
index 0000000000..03f7a6232d
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/Configuration.json
@@ -0,0 +1,6 @@
+{
+ "output-folder": ".",
+ "namespace": "Resiliency.ServiceDriven",
+ "library-name": "Resiliency.ServiceDriven",
+ "use-model-reader-writer": true
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/Resiliency.ServiceDriven.sln b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/Resiliency.ServiceDriven.sln
new file mode 100644
index 0000000000..1022c33783
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/Resiliency.ServiceDriven.sln
@@ -0,0 +1,48 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29709.97
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Resiliency.ServiceDriven", "src\Resiliency.ServiceDriven.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE}
+ EndGlobalSection
+EndGlobal
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/src/Generated/ResiliencyServiceDrivenClient.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/src/Generated/ResiliencyServiceDrivenClient.cs
new file mode 100644
index 0000000000..f29fe426e3
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/src/Generated/ResiliencyServiceDrivenClient.cs
@@ -0,0 +1,54 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+
+namespace Resiliency.ServiceDriven
+{
+ public partial class ResiliencyServiceDrivenClient
+ {
+ protected ResiliencyServiceDrivenClient() => throw null;
+
+ public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion) : this(endpoint, serviceDeploymentVersion, new ResiliencyServiceDrivenClientOptions()) => throw null;
+
+ public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult AddOperation(RequestOptions options) => throw null;
+
+ public virtual Task AddOperationAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult AddOperation() => throw null;
+
+ public virtual Task AddOperationAsync() => throw null;
+
+ public virtual ClientResult FromNone(string newParameter, RequestOptions options = null) => throw null;
+
+ public virtual Task FromNoneAsync(string newParameter, RequestOptions options = null) => throw null;
+
+ public virtual ClientResult FromNone(string newParameter = null) => throw null;
+
+ public virtual Task FromNoneAsync(string newParameter = null) => throw null;
+
+ public virtual ClientResult FromOneRequired(string parameter, string newParameter, RequestOptions options = null) => throw null;
+
+ public virtual Task FromOneRequiredAsync(string parameter, string newParameter, RequestOptions options = null) => throw null;
+
+ public virtual ClientResult FromOneRequired(string parameter, string newParameter = null) => throw null;
+
+ public virtual Task FromOneRequiredAsync(string parameter, string newParameter = null) => throw null;
+
+ public virtual ClientResult FromOneOptional(string parameter, string newParameter, RequestOptions options = null) => throw null;
+
+ public virtual Task FromOneOptionalAsync(string parameter, string newParameter, RequestOptions options = null) => throw null;
+
+ public virtual ClientResult FromOneOptional(string parameter = null, string newParameter = null) => throw null;
+
+ public virtual Task FromOneOptionalAsync(string parameter = null, string newParameter = null) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/src/Generated/ResiliencyServiceDrivenClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/src/Generated/ResiliencyServiceDrivenClientOptions.cs
new file mode 100644
index 0000000000..233945b82e
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/src/Generated/ResiliencyServiceDrivenClientOptions.cs
@@ -0,0 +1,23 @@
+//
+
+#nullable disable
+
+using System.ClientModel.Primitives;
+
+namespace Resiliency.ServiceDriven
+{
+ public partial class ResiliencyServiceDrivenClientOptions : ClientPipelineOptions
+ {
+ private const ServiceVersion LatestVersion = ServiceVersion.V2;
+
+ public ResiliencyServiceDrivenClientOptions(ServiceVersion version = LatestVersion) => throw null;
+
+ public enum ServiceVersion
+ {
+ /// Version 1.
+ V1 = 1,
+ /// Version 2.
+ V2 = 2
+ }
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/src/Resiliency.ServiceDriven.csproj b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/src/Resiliency.ServiceDriven.csproj
new file mode 100644
index 0000000000..a8a84fc716
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/src/Resiliency.ServiceDriven.csproj
@@ -0,0 +1,16 @@
+
+
+ This is the Resiliency.ServiceDriven client library for developing .NET applications with rich experience.
+ SDK Code Generation Resiliency.ServiceDriven
+ 1.0.0-beta.1
+ Resiliency.ServiceDriven
+ netstandard2.0
+ latest
+ true
+
+
+
+
+
+
+
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/tspCodeModel.json b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/tspCodeModel.json
new file mode 100644
index 0000000000..e1f8299af3
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/tspCodeModel.json
@@ -0,0 +1,382 @@
+{
+ "$id": "1",
+ "Name": "Resiliency.ServiceDriven",
+ "ApiVersions": [
+ "v1",
+ "v2"
+ ],
+ "Enums": [
+ {
+ "$id": "2",
+ "kind": "enum",
+ "name": "Versions",
+ "crossLanguageDefinitionId": "Resiliency.ServiceDriven.Versions",
+ "valueType": {
+ "$id": "3",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "values": [
+ {
+ "$id": "4",
+ "kind": "enumvalue",
+ "name": "v1",
+ "value": "v1",
+ "valueType": {
+ "$id": "5",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "enumType": {
+ "$ref": "2"
+ },
+ "description": "Version 1",
+ "decorators": []
+ },
+ {
+ "$id": "6",
+ "kind": "enumvalue",
+ "name": "v2",
+ "value": "v2",
+ "valueType": {
+ "$id": "7",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "enumType": {
+ "$ref": "2"
+ },
+ "description": "Version 2",
+ "decorators": []
+ }
+ ],
+ "description": "Service versions",
+ "isFixed": true,
+ "isFlags": false,
+ "usage": "ApiVersionEnum",
+ "decorators": []
+ }
+ ],
+ "Models": [],
+ "Clients": [
+ {
+ "$id": "8",
+ "Name": "ResiliencyServiceDrivenClient",
+ "Description": "Test that we can grow up a service spec and service deployment into a multi-versioned service with full client support.\n\nThere are three concepts that should be clarified:\n1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp and 'v2' is a client generated from main.tsp.\n2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions\n3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the service supports api versions 'v1' and 'v2'.\n\nWe test the following configurations from this service spec:\n- A client generated from the second service spec can call the second deployment of a service with api version v1\n- A client generated from the second service spec can call the second deployment of a service with api version v2",
+ "Operations": [
+ {
+ "$id": "9",
+ "Name": "addOperation",
+ "ResourceName": "ServiceDriven",
+ "Description": "Added operation",
+ "Accessibility": "public",
+ "Parameters": [],
+ "Responses": [
+ {
+ "$id": "10",
+ "StatusCodes": [
+ 204
+ ],
+ "BodyMediaType": "Json",
+ "Headers": [],
+ "IsErrorResponse": false
+ }
+ ],
+ "HttpMethod": "DELETE",
+ "RequestBodyMediaType": "None",
+ "Uri": "{endpoint}/resiliency/service-driven/client:v2/service:{serviceDeploymentVersion}/api-version:{apiVersion}",
+ "Path": "/add-operation",
+ "BufferResponse": true,
+ "GenerateProtocolMethod": true,
+ "GenerateConvenienceMethod": true,
+ "CrossLanguageDefinitionId": "Resiliency.ServiceDriven.addOperation",
+ "Decorators": []
+ },
+ {
+ "$id": "11",
+ "Name": "fromNone",
+ "ResourceName": "AddOptionalParam",
+ "Description": "Test that grew up from accepting no parameters to an optional input parameter",
+ "Accessibility": "public",
+ "Parameters": [
+ {
+ "$id": "12",
+ "Name": "new-parameter",
+ "NameInRequest": "new-parameter",
+ "Description": "I'm a new input optional parameter",
+ "Type": {
+ "$id": "13",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "Location": "Query",
+ "IsApiVersion": false,
+ "IsContentType": false,
+ "IsEndpoint": false,
+ "Explode": false,
+ "IsRequired": false,
+ "Kind": "Method",
+ "Decorators": [],
+ "SkipUrlEncoding": false
+ }
+ ],
+ "Responses": [
+ {
+ "$id": "14",
+ "StatusCodes": [
+ 204
+ ],
+ "BodyMediaType": "Json",
+ "Headers": [],
+ "IsErrorResponse": false
+ }
+ ],
+ "HttpMethod": "HEAD",
+ "RequestBodyMediaType": "None",
+ "Uri": "{endpoint}/resiliency/service-driven/client:v2/service:{serviceDeploymentVersion}/api-version:{apiVersion}",
+ "Path": "/add-optional-param/from-none",
+ "BufferResponse": true,
+ "GenerateProtocolMethod": true,
+ "GenerateConvenienceMethod": true,
+ "CrossLanguageDefinitionId": "Resiliency.ServiceDriven.AddOptionalParam.fromNone",
+ "Decorators": []
+ },
+ {
+ "$id": "15",
+ "Name": "fromOneRequired",
+ "ResourceName": "AddOptionalParam",
+ "Description": "Operation that grew up from accepting one required parameter to accepting a required parameter and an optional parameter.",
+ "Accessibility": "public",
+ "Parameters": [
+ {
+ "$id": "16",
+ "Name": "parameter",
+ "NameInRequest": "parameter",
+ "Description": "I am a required parameter",
+ "Type": {
+ "$id": "17",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "Location": "Query",
+ "IsApiVersion": false,
+ "IsContentType": false,
+ "IsEndpoint": false,
+ "Explode": false,
+ "IsRequired": true,
+ "Kind": "Method",
+ "Decorators": [],
+ "SkipUrlEncoding": false
+ },
+ {
+ "$id": "18",
+ "Name": "new-parameter",
+ "NameInRequest": "new-parameter",
+ "Description": "I'm a new input optional parameter",
+ "Type": {
+ "$id": "19",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "Location": "Query",
+ "IsApiVersion": false,
+ "IsContentType": false,
+ "IsEndpoint": false,
+ "Explode": false,
+ "IsRequired": false,
+ "Kind": "Method",
+ "Decorators": [],
+ "SkipUrlEncoding": false
+ }
+ ],
+ "Responses": [
+ {
+ "$id": "20",
+ "StatusCodes": [
+ 204
+ ],
+ "BodyMediaType": "Json",
+ "Headers": [],
+ "IsErrorResponse": false
+ }
+ ],
+ "HttpMethod": "GET",
+ "RequestBodyMediaType": "None",
+ "Uri": "{endpoint}/resiliency/service-driven/client:v2/service:{serviceDeploymentVersion}/api-version:{apiVersion}",
+ "Path": "/add-optional-param/from-one-required",
+ "BufferResponse": true,
+ "GenerateProtocolMethod": true,
+ "GenerateConvenienceMethod": true,
+ "CrossLanguageDefinitionId": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired",
+ "Decorators": []
+ },
+ {
+ "$id": "21",
+ "Name": "fromOneOptional",
+ "ResourceName": "AddOptionalParam",
+ "Description": "Tests that we can grow up an operation from accepting one optional parameter to accepting two optional parameters.",
+ "Accessibility": "public",
+ "Parameters": [
+ {
+ "$id": "22",
+ "Name": "parameter",
+ "NameInRequest": "parameter",
+ "Description": "I am an optional parameter",
+ "Type": {
+ "$id": "23",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "Location": "Query",
+ "IsApiVersion": false,
+ "IsContentType": false,
+ "IsEndpoint": false,
+ "Explode": false,
+ "IsRequired": false,
+ "Kind": "Method",
+ "Decorators": [],
+ "SkipUrlEncoding": false
+ },
+ {
+ "$id": "24",
+ "Name": "new-parameter",
+ "NameInRequest": "new-parameter",
+ "Description": "I'm a new input optional parameter",
+ "Type": {
+ "$id": "25",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "Location": "Query",
+ "IsApiVersion": false,
+ "IsContentType": false,
+ "IsEndpoint": false,
+ "Explode": false,
+ "IsRequired": false,
+ "Kind": "Method",
+ "Decorators": [],
+ "SkipUrlEncoding": false
+ }
+ ],
+ "Responses": [
+ {
+ "$id": "26",
+ "StatusCodes": [
+ 204
+ ],
+ "BodyMediaType": "Json",
+ "Headers": [],
+ "IsErrorResponse": false
+ }
+ ],
+ "HttpMethod": "GET",
+ "RequestBodyMediaType": "None",
+ "Uri": "{endpoint}/resiliency/service-driven/client:v2/service:{serviceDeploymentVersion}/api-version:{apiVersion}",
+ "Path": "/add-optional-param/from-one-optional",
+ "BufferResponse": true,
+ "GenerateProtocolMethod": true,
+ "GenerateConvenienceMethod": true,
+ "CrossLanguageDefinitionId": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional",
+ "Decorators": []
+ }
+ ],
+ "Protocol": {
+ "$id": "27"
+ },
+ "Parameters": [
+ {
+ "$id": "28",
+ "Name": "endpoint",
+ "NameInRequest": "endpoint",
+ "Description": "Need to be set as 'http://localhost:3000' in client.",
+ "Type": {
+ "$id": "29",
+ "kind": "url",
+ "name": "url",
+ "crossLanguageDefinitionId": "TypeSpec.url"
+ },
+ "Location": "Uri",
+ "IsApiVersion": false,
+ "IsResourceParameter": false,
+ "IsContentType": false,
+ "IsRequired": true,
+ "IsEndpoint": true,
+ "SkipUrlEncoding": false,
+ "Explode": false,
+ "Kind": "Client"
+ },
+ {
+ "$id": "30",
+ "Name": "serviceDeploymentVersion",
+ "NameInRequest": "serviceDeploymentVersion",
+ "Description": "Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when the service had api-versions 'v1' and 'v2'.",
+ "Type": {
+ "$id": "31",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "Location": "Uri",
+ "IsApiVersion": false,
+ "IsResourceParameter": false,
+ "IsContentType": false,
+ "IsRequired": true,
+ "IsEndpoint": false,
+ "SkipUrlEncoding": false,
+ "Explode": false,
+ "Kind": "Client"
+ },
+ {
+ "$id": "32",
+ "Name": "apiVersion",
+ "NameInRequest": "apiVersion",
+ "Description": "Pass in either 'v1' or 'v2'. This represents the API version of a service.",
+ "Type": {
+ "$id": "33",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "Location": "Uri",
+ "IsApiVersion": true,
+ "IsResourceParameter": false,
+ "IsContentType": false,
+ "IsRequired": true,
+ "IsEndpoint": false,
+ "SkipUrlEncoding": false,
+ "Explode": false,
+ "Kind": "Client",
+ "DefaultValue": {
+ "$id": "34",
+ "Type": {
+ "$id": "35",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string"
+ },
+ "Value": "v2"
+ }
+ }
+ ],
+ "Decorators": []
+ }
+ ]
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/Configuration.json b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/Configuration.json
new file mode 100644
index 0000000000..23dcd7aba7
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/Configuration.json
@@ -0,0 +1,6 @@
+{
+ "output-folder": ".",
+ "namespace": "Resiliency.ServiceDriven.V1",
+ "library-name": "Resiliency.ServiceDriven.V1",
+ "use-model-reader-writer": true
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/Resiliency.ServiceDriven.V1.sln b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/Resiliency.ServiceDriven.V1.sln
new file mode 100644
index 0000000000..2507d0b1ce
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/Resiliency.ServiceDriven.V1.sln
@@ -0,0 +1,48 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29709.97
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Resiliency.ServiceDriven.V1", "src\Resiliency.ServiceDriven.V1.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE}
+ EndGlobalSection
+EndGlobal
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs
new file mode 100644
index 0000000000..b56969f2a4
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs
@@ -0,0 +1,46 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+
+namespace Resiliency.ServiceDriven.V1
+{
+ public partial class ResiliencyServiceDrivenClient
+ {
+ protected ResiliencyServiceDrivenClient() => throw null;
+
+ public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion) : this(endpoint, serviceDeploymentVersion, new ResiliencyServiceDrivenClientOptions()) => throw null;
+
+ public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult FromNone(RequestOptions options) => throw null;
+
+ public virtual Task FromNoneAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult FromNone() => throw null;
+
+ public virtual Task FromNoneAsync() => throw null;
+
+ public virtual ClientResult FromOneRequired(string parameter, RequestOptions options) => throw null;
+
+ public virtual Task FromOneRequiredAsync(string parameter, RequestOptions options) => throw null;
+
+ public virtual ClientResult FromOneRequired(string parameter) => throw null;
+
+ public virtual Task FromOneRequiredAsync(string parameter) => throw null;
+
+ public virtual ClientResult FromOneOptional(string parameter, RequestOptions options = null) => throw null;
+
+ public virtual Task FromOneOptionalAsync(string parameter, RequestOptions options = null) => throw null;
+
+ public virtual ClientResult FromOneOptional(string parameter = null) => throw null;
+
+ public virtual Task FromOneOptionalAsync(string parameter = null) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClientOptions.cs
new file mode 100644
index 0000000000..9c387842e9
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClientOptions.cs
@@ -0,0 +1,21 @@
+//
+
+#nullable disable
+
+using System.ClientModel.Primitives;
+
+namespace Resiliency.ServiceDriven.V1
+{
+ public partial class ResiliencyServiceDrivenClientOptions : ClientPipelineOptions
+ {
+ private const ServiceVersion LatestVersion = ServiceVersion.V1;
+
+ public ResiliencyServiceDrivenClientOptions(ServiceVersion version = LatestVersion) => throw null;
+
+ public enum ServiceVersion
+ {
+ /// Version 1.
+ V1 = 1
+ }
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/src/Resiliency.ServiceDriven.V1.csproj b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/src/Resiliency.ServiceDriven.V1.csproj
new file mode 100644
index 0000000000..fa7663cb74
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/src/Resiliency.ServiceDriven.V1.csproj
@@ -0,0 +1,16 @@
+
+
+ This is the Resiliency.ServiceDriven.V1 client library for developing .NET applications with rich experience.
+ SDK Code Generation Resiliency.ServiceDriven.V1
+ 1.0.0-beta.1
+ Resiliency.ServiceDriven.V1
+ netstandard2.0
+ latest
+ true
+
+
+
+
+
+
+
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/tspCodeModel.json b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/tspCodeModel.json
new file mode 100644
index 0000000000..74f6ea412a
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/v1/tspCodeModel.json
@@ -0,0 +1,268 @@
+{
+ "$id": "1",
+ "Name": "Resiliency.ServiceDriven",
+ "ApiVersions": [
+ "v1"
+ ],
+ "Enums": [
+ {
+ "$id": "2",
+ "kind": "enum",
+ "name": "Versions",
+ "crossLanguageDefinitionId": "Resiliency.ServiceDriven.Versions",
+ "valueType": {
+ "$id": "3",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "values": [
+ {
+ "$id": "4",
+ "kind": "enumvalue",
+ "name": "v1",
+ "value": "v1",
+ "valueType": {
+ "$id": "5",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "enumType": {
+ "$ref": "2"
+ },
+ "description": "Version 1",
+ "decorators": []
+ }
+ ],
+ "description": "Service versions.",
+ "isFixed": true,
+ "isFlags": false,
+ "usage": "ApiVersionEnum",
+ "decorators": []
+ }
+ ],
+ "Models": [],
+ "Clients": [
+ {
+ "$id": "6",
+ "Name": "ResiliencyServiceDrivenClient",
+ "Description": "Test that we can grow up a service spec and service deployment into a multi-versioned service with full client support.",
+ "Operations": [
+ {
+ "$id": "7",
+ "Name": "fromNone",
+ "ResourceName": "AddOptionalParam",
+ "Description": "Test that currently accepts no parameters, will be updated in next spec to accept a new optional parameter as well",
+ "Accessibility": "public",
+ "Parameters": [],
+ "Responses": [
+ {
+ "$id": "8",
+ "StatusCodes": [
+ 204
+ ],
+ "BodyMediaType": "Json",
+ "Headers": [],
+ "IsErrorResponse": false
+ }
+ ],
+ "HttpMethod": "HEAD",
+ "RequestBodyMediaType": "None",
+ "Uri": "{endpoint}/resiliency/service-driven/client:v1/service:{serviceDeploymentVersion}/api-version:{apiVersion}",
+ "Path": "/add-optional-param/from-none",
+ "BufferResponse": true,
+ "GenerateProtocolMethod": true,
+ "GenerateConvenienceMethod": true,
+ "CrossLanguageDefinitionId": "Resiliency.ServiceDriven.AddOptionalParam.fromNone",
+ "Decorators": []
+ },
+ {
+ "$id": "9",
+ "Name": "fromOneRequired",
+ "ResourceName": "AddOptionalParam",
+ "Description": "Test that currently accepts one required parameter, will be updated in next spec to accept a new optional parameter as well",
+ "Accessibility": "public",
+ "Parameters": [
+ {
+ "$id": "10",
+ "Name": "parameter",
+ "NameInRequest": "parameter",
+ "Description": "I am a required parameter",
+ "Type": {
+ "$id": "11",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "Location": "Query",
+ "IsApiVersion": false,
+ "IsContentType": false,
+ "IsEndpoint": false,
+ "Explode": false,
+ "IsRequired": true,
+ "Kind": "Method",
+ "Decorators": [],
+ "SkipUrlEncoding": false
+ }
+ ],
+ "Responses": [
+ {
+ "$id": "12",
+ "StatusCodes": [
+ 204
+ ],
+ "BodyMediaType": "Json",
+ "Headers": [],
+ "IsErrorResponse": false
+ }
+ ],
+ "HttpMethod": "GET",
+ "RequestBodyMediaType": "None",
+ "Uri": "{endpoint}/resiliency/service-driven/client:v1/service:{serviceDeploymentVersion}/api-version:{apiVersion}",
+ "Path": "/add-optional-param/from-one-required",
+ "BufferResponse": true,
+ "GenerateProtocolMethod": true,
+ "GenerateConvenienceMethod": true,
+ "CrossLanguageDefinitionId": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired",
+ "Decorators": []
+ },
+ {
+ "$id": "13",
+ "Name": "fromOneOptional",
+ "ResourceName": "AddOptionalParam",
+ "Description": "Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional parameter as well",
+ "Accessibility": "public",
+ "Parameters": [
+ {
+ "$id": "14",
+ "Name": "parameter",
+ "NameInRequest": "parameter",
+ "Description": "I am an optional parameter",
+ "Type": {
+ "$id": "15",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "Location": "Query",
+ "IsApiVersion": false,
+ "IsContentType": false,
+ "IsEndpoint": false,
+ "Explode": false,
+ "IsRequired": false,
+ "Kind": "Method",
+ "Decorators": [],
+ "SkipUrlEncoding": false
+ }
+ ],
+ "Responses": [
+ {
+ "$id": "16",
+ "StatusCodes": [
+ 204
+ ],
+ "BodyMediaType": "Json",
+ "Headers": [],
+ "IsErrorResponse": false
+ }
+ ],
+ "HttpMethod": "GET",
+ "RequestBodyMediaType": "None",
+ "Uri": "{endpoint}/resiliency/service-driven/client:v1/service:{serviceDeploymentVersion}/api-version:{apiVersion}",
+ "Path": "/add-optional-param/from-one-optional",
+ "BufferResponse": true,
+ "GenerateProtocolMethod": true,
+ "GenerateConvenienceMethod": true,
+ "CrossLanguageDefinitionId": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional",
+ "Decorators": []
+ }
+ ],
+ "Protocol": {
+ "$id": "17"
+ },
+ "Parameters": [
+ {
+ "$id": "18",
+ "Name": "endpoint",
+ "NameInRequest": "endpoint",
+ "Description": "Need to be set as 'http://localhost:3000' in client.",
+ "Type": {
+ "$id": "19",
+ "kind": "url",
+ "name": "url",
+ "crossLanguageDefinitionId": "TypeSpec.url"
+ },
+ "Location": "Uri",
+ "IsApiVersion": false,
+ "IsResourceParameter": false,
+ "IsContentType": false,
+ "IsRequired": true,
+ "IsEndpoint": true,
+ "SkipUrlEncoding": false,
+ "Explode": false,
+ "Kind": "Client"
+ },
+ {
+ "$id": "20",
+ "Name": "serviceDeploymentVersion",
+ "NameInRequest": "serviceDeploymentVersion",
+ "Description": "Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when the service had api-versions 'v1' and 'v2'.",
+ "Type": {
+ "$id": "21",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "Location": "Uri",
+ "IsApiVersion": false,
+ "IsResourceParameter": false,
+ "IsContentType": false,
+ "IsRequired": true,
+ "IsEndpoint": false,
+ "SkipUrlEncoding": false,
+ "Explode": false,
+ "Kind": "Client"
+ },
+ {
+ "$id": "22",
+ "Name": "apiVersion",
+ "NameInRequest": "apiVersion",
+ "Description": "Pass in 'v1'. This represents the API version of the service. Will grow up in the next deployment to be both 'v1' and 'v2'",
+ "Type": {
+ "$id": "23",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "Location": "Uri",
+ "IsApiVersion": true,
+ "IsResourceParameter": false,
+ "IsContentType": false,
+ "IsRequired": true,
+ "IsEndpoint": false,
+ "SkipUrlEncoding": false,
+ "Explode": false,
+ "Kind": "Client",
+ "DefaultValue": {
+ "$id": "24",
+ "Type": {
+ "$id": "25",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string"
+ },
+ "Value": "v1"
+ }
+ }
+ ],
+ "Decorators": []
+ }
+ ]
+}