Skip to content

Commit b89d007

Browse files
Adopt OAuth spector scenarios (#49430)
* Adopt OAuth spector scenarios * remove STJ
1 parent cdd7391 commit b89d007

File tree

65 files changed

+1165
-304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1165
-304
lines changed

eng/packages/http-client-csharp/eng/scripts/Generate.ps1

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
param(
33
$filter,
44
[bool]$Stubbed = $true,
5-
[bool]$LaunchOnly = $false,
6-
[switch]$ForceNewProject = $false
5+
[bool]$LaunchOnly = $false
76
)
87

98
Import-Module "$PSScriptRoot\Generation.psm1" -DisableNameChecking -Force;
@@ -22,7 +21,7 @@ if (-not $LaunchOnly) {
2221

2322
$basicTypespecTestProject = Join-Path $testProjectsLocalDir "Basic-TypeSpec"
2423

25-
Invoke (Get-TspCommand "$basicTypespecTestProject/Basic-TypeSpec.tsp" $basicTypespecTestProject -forceNewProject $ForceNewProject)
24+
Invoke (Get-TspCommand "$basicTypespecTestProject/Basic-TypeSpec.tsp" $basicTypespecTestProject)
2625

2726
# exit if the generation failed
2827
if ($LASTEXITCODE -ne 0) {
@@ -162,7 +161,7 @@ foreach ($directory in $directories) {
162161
}
163162

164163
Write-Host "Generating $subPath" -ForegroundColor Cyan
165-
Invoke (Get-TspCommand $specFile $generationDir $stubbed -forceNewProject $ForceNewProject)
164+
Invoke (Get-TspCommand $specFile $generationDir $stubbed)
166165

167166
# exit if the generation failed
168167
if ($LASTEXITCODE -ne 0) {
@@ -185,7 +184,7 @@ if ($null -eq $filter) {
185184

186185
foreach ($kvp in $spectorLaunchProjects.GetEnumerator()) {
187186
$launchSettings["profiles"].Add($kvp.Key, @{})
188-
$launchSettings["profiles"][$kvp.Key].Add("commandLineArgs", "`$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll `$(SolutionDir)/$($kvp.Value) -g AzureClientGenerator")
187+
$launchSettings["profiles"][$kvp.Key].Add("commandLineArgs", "`$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll `$(SolutionDir)/$($kvp.Value) -g AzureStubGenerator")
189188
$launchSettings["profiles"][$kvp.Key].Add("commandName", "Executable")
190189
$launchSettings["profiles"][$kvp.Key].Add("executablePath", "dotnet")
191190
}

eng/packages/http-client-csharp/eng/scripts/Generation.psm1

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ function Get-TspCommand {
2525
[string]$specFile,
2626
[string]$generationDir,
2727
[bool]$generateStub = $false,
28-
[string]$apiVersion = $null,
29-
[bool]$forceNewProject = $false
28+
[string]$apiVersion = $null
3029
)
3130
$command = "npx tsp compile $specFile"
3231
$command += " --trace @azure-typespec/http-client-csharp"
@@ -45,9 +44,7 @@ function Get-TspCommand {
4544
$command += " --option @azure-typespec/http-client-csharp.api-version=$apiVersion"
4645
}
4746

48-
if ($forceNewProject) {
49-
$command += " --option @azure-typespec/http-client-csharp.new-project=true"
50-
}
47+
$command += " --option @azure-typespec/http-client-csharp.new-project=true"
5148

5249
return $command
5350
}
@@ -63,7 +60,7 @@ function Get-Mgmt-TspCommand {
6360
$command = "npx tsp compile $specFile"
6461
$command += " --trace @azure-typespec/http-client-csharp-mgmt"
6562
$command += " --emit $repoRoot/../../http-client-csharp-mgmt"
66-
63+
6764
$configFile = Join-Path $generationDir "tspconfig.yaml"
6865
if (Test-Path $configFile) {
6966
$command += " --config=$configFile"
@@ -73,7 +70,7 @@ function Get-Mgmt-TspCommand {
7370
if ($generateStub) {
7471
$command += " --option @azure-typespec/http-client-csharp-mgmt.plugin-name=AzureStubPlugin"
7572
}
76-
73+
7774
if ($apiVersion) {
7875
$command += " --option @azure-typespec/http-client-csharp-mgmt.api-version=$apiVersion"
7976
}
@@ -87,7 +84,7 @@ function Get-Mgmt-TspCommand {
8784

8885
function Refresh-Build {
8986
Write-Host "Building emitter and generator" -ForegroundColor Cyan
90-
Invoke "npm run build:emitter"
87+
Invoke "npm run build:emitter"
9188
# exit if the generation failed
9289
if ($LASTEXITCODE -ne 0) {
9390
exit $LASTEXITCODE

eng/packages/http-client-csharp/generator/Azure.Generator/src/AzureTypeFactory.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ public class AzureTypeFactory : ScmTypeFactory
5151
/// </summary>
5252
protected internal virtual IReadOnlyList<CSharpProjectWriter.CSProjDependencyPackage> AzureDependencyPackages =>
5353
[
54-
new("Azure.Core"),
55-
new("System.ClientModel"),
56-
new("System.Text.Json")
54+
new("Azure.Core")
5755
];
5856

5957
/// <inheritdoc/>

eng/packages/http-client-csharp/generator/Azure.Generator/src/Properties/launchSettings.json

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,147 +6,147 @@
66
"executablePath": "dotnet"
77
},
88
"http-authentication-api-key": {
9-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/authentication/api-key -g AzureClientGenerator",
9+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/authentication/api-key -g AzureStubGenerator",
1010
"commandName": "Executable",
1111
"executablePath": "dotnet"
1212
},
1313
"http-authentication-http-custom": {
14-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/authentication/http/custom -g AzureClientGenerator",
14+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/authentication/http/custom -g AzureStubGenerator",
1515
"commandName": "Executable",
1616
"executablePath": "dotnet"
1717
},
1818
"http-authentication-oauth2": {
19-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/authentication/oauth2 -g AzureClientGenerator",
19+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/authentication/oauth2 -g AzureStubGenerator",
2020
"commandName": "Executable",
2121
"executablePath": "dotnet"
2222
},
2323
"http-authentication-union": {
24-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/authentication/union -g AzureClientGenerator",
24+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/authentication/union -g AzureStubGenerator",
2525
"commandName": "Executable",
2626
"executablePath": "dotnet"
2727
},
2828
"http-client-structure-default": {
29-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/client/structure/default -g AzureClientGenerator",
29+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/client/structure/default -g AzureStubGenerator",
3030
"commandName": "Executable",
3131
"executablePath": "dotnet"
3232
},
3333
"http-encode-numeric": {
34-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/encode/numeric -g AzureClientGenerator",
34+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/encode/numeric -g AzureStubGenerator",
3535
"commandName": "Executable",
3636
"executablePath": "dotnet"
3737
},
3838
"http-parameters-basic": {
39-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/parameters/basic -g AzureClientGenerator",
39+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/parameters/basic -g AzureStubGenerator",
4040
"commandName": "Executable",
4141
"executablePath": "dotnet"
4242
},
4343
"http-parameters-body-optionality": {
44-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/parameters/body-optionality -g AzureClientGenerator",
44+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/parameters/body-optionality -g AzureStubGenerator",
4545
"commandName": "Executable",
4646
"executablePath": "dotnet"
4747
},
4848
"http-parameters-spread": {
49-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/parameters/spread -g AzureClientGenerator",
49+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/parameters/spread -g AzureStubGenerator",
5050
"commandName": "Executable",
5151
"executablePath": "dotnet"
5252
},
5353
"http-payload-content-negotiation": {
54-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/payload/content-negotiation -g AzureClientGenerator",
54+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/payload/content-negotiation -g AzureStubGenerator",
5555
"commandName": "Executable",
5656
"executablePath": "dotnet"
5757
},
5858
"http-payload-json-merge-patch": {
59-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/payload/json-merge-patch -g AzureClientGenerator",
59+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/payload/json-merge-patch -g AzureStubGenerator",
6060
"commandName": "Executable",
6161
"executablePath": "dotnet"
6262
},
6363
"http-payload-media-type": {
64-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/payload/media-type -g AzureClientGenerator",
64+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/payload/media-type -g AzureStubGenerator",
6565
"commandName": "Executable",
6666
"executablePath": "dotnet"
6767
},
6868
"http-serialization-encoded-name-json": {
69-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/serialization/encoded-name/json -g AzureClientGenerator",
69+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/serialization/encoded-name/json -g AzureStubGenerator",
7070
"commandName": "Executable",
7171
"executablePath": "dotnet"
7272
},
7373
"http-server-endpoint-not-defined": {
74-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/server/endpoint/not-defined -g AzureClientGenerator",
74+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/server/endpoint/not-defined -g AzureStubGenerator",
7575
"commandName": "Executable",
7676
"executablePath": "dotnet"
7777
},
7878
"http-server-path-single": {
79-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/server/path/single -g AzureClientGenerator",
79+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/server/path/single -g AzureStubGenerator",
8080
"commandName": "Executable",
8181
"executablePath": "dotnet"
8282
},
8383
"http-server-versions-not-versioned": {
84-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/server/versions/not-versioned -g AzureClientGenerator",
84+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/server/versions/not-versioned -g AzureStubGenerator",
8585
"commandName": "Executable",
8686
"executablePath": "dotnet"
8787
},
8888
"http-special-headers-conditional-request": {
89-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/special-headers/conditional-request -g AzureClientGenerator",
89+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/special-headers/conditional-request -g AzureStubGenerator",
9090
"commandName": "Executable",
9191
"executablePath": "dotnet"
9292
},
9393
"http-special-headers-repeatability": {
94-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/special-headers/repeatability -g AzureClientGenerator",
94+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/special-headers/repeatability -g AzureStubGenerator",
9595
"commandName": "Executable",
9696
"executablePath": "dotnet"
9797
},
9898
"http-special-words": {
99-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/special-words -g AzureClientGenerator",
99+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/special-words -g AzureStubGenerator",
100100
"commandName": "Executable",
101101
"executablePath": "dotnet"
102102
},
103103
"http-streaming-jsonl": {
104-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/streaming/jsonl -g AzureClientGenerator",
104+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/streaming/jsonl -g AzureStubGenerator",
105105
"commandName": "Executable",
106106
"executablePath": "dotnet"
107107
},
108108
"http-type-enum-fixed": {
109-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/enum/fixed -g AzureClientGenerator",
109+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/enum/fixed -g AzureStubGenerator",
110110
"commandName": "Executable",
111111
"executablePath": "dotnet"
112112
},
113113
"http-type-model-empty": {
114-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/model/empty -g AzureClientGenerator",
114+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/model/empty -g AzureStubGenerator",
115115
"commandName": "Executable",
116116
"executablePath": "dotnet"
117117
},
118118
"http-type-model-inheritance-nested-discriminator": {
119-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/model/inheritance/nested-discriminator -g AzureClientGenerator",
119+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/model/inheritance/nested-discriminator -g AzureStubGenerator",
120120
"commandName": "Executable",
121121
"executablePath": "dotnet"
122122
},
123123
"http-type-model-inheritance-not-discriminated": {
124-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/model/inheritance/not-discriminated -g AzureClientGenerator",
124+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/model/inheritance/not-discriminated -g AzureStubGenerator",
125125
"commandName": "Executable",
126126
"executablePath": "dotnet"
127127
},
128128
"http-type-model-inheritance-recursive": {
129-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/model/inheritance/recursive -g AzureClientGenerator",
129+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/model/inheritance/recursive -g AzureStubGenerator",
130130
"commandName": "Executable",
131131
"executablePath": "dotnet"
132132
},
133133
"http-type-model-inheritance-single-discriminator": {
134-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/model/inheritance/single-discriminator -g AzureClientGenerator",
134+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/model/inheritance/single-discriminator -g AzureStubGenerator",
135135
"commandName": "Executable",
136136
"executablePath": "dotnet"
137137
},
138138
"http-type-model-usage": {
139-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/model/usage -g AzureClientGenerator",
139+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/model/usage -g AzureStubGenerator",
140140
"commandName": "Executable",
141141
"executablePath": "dotnet"
142142
},
143143
"http-type-model-visibility": {
144-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/model/visibility -g AzureClientGenerator",
144+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/model/visibility -g AzureStubGenerator",
145145
"commandName": "Executable",
146146
"executablePath": "dotnet"
147147
},
148148
"http-type-property-nullable": {
149-
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/property/nullable -g AzureClientGenerator",
149+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/type/property/nullable -g AzureStubGenerator",
150150
"commandName": "Executable",
151151
"executablePath": "dotnet"
152152
}

eng/packages/http-client-csharp/generator/TestProjects/Local/Basic-TypeSpec/src/BasicTypeSpec.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,5 @@
1414

1515
<ItemGroup>
1616
<PackageReference Include="Azure.Core" />
17-
<PackageReference Include="System.ClientModel" />
18-
<PackageReference Include="System.Text.Json" />
1917
</ItemGroup>
2018
</Project>

0 commit comments

Comments
 (0)