Skip to content

Commit 920d1e0

Browse files
committed
fixed test samples
1 parent d4b2ef1 commit 920d1e0

Some content is hidden

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

42 files changed

+389
-389
lines changed
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
5-
<AssemblyName>Fonlow.OpenApiClientGen.Aurelia</AssemblyName>
6-
<RootNamespace>Fonlow.OpenApiClientGen.Aurelia</RootNamespace>
7-
<Authors>Zijian Huang</Authors>
8-
<Copyright>Copyright © Zijian Huang 2021-2024</Copyright>
9-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
10-
<PackageProjectUrl>https://github.com/zijianhuang/openapiclientgen</PackageProjectUrl>
11-
<NeutralLanguage>en</NeutralLanguage>
12-
<Version>2.2</Version>
13-
<AnalysisLevel>latest-all</AnalysisLevel>
14-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<AssemblyName>Fonlow.OpenApiClientGen.Aurelia</AssemblyName>
6+
<RootNamespace>Fonlow.OpenApiClientGen.Aurelia</RootNamespace>
7+
<Authors>Zijian Huang</Authors>
8+
<Copyright>Copyright © Zijian Huang 2021-$([System.DateTime]::Now.Year)</Copyright>
9+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
10+
<PackageProjectUrl>https://github.com/zijianhuang/openapiclientgen</PackageProjectUrl>
11+
<NeutralLanguage>en</NeutralLanguage>
12+
<Version>2.2.1</Version>
13+
<AnalysisLevel>latest-all</AnalysisLevel>
14+
</PropertyGroup>
1515

16-
<ItemGroup>
17-
<ProjectReference Include="..\Fonlow.OpenApiClientGen.Abstract\Fonlow.OpenApiClientGen.Abstract.csproj" />
18-
</ItemGroup>
16+
<ItemGroup>
17+
<ProjectReference Include="..\Fonlow.OpenApiClientGen.Abstract\Fonlow.OpenApiClientGen.Abstract.csproj" />
18+
</ItemGroup>
1919

20-
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
21-
<Exec Command="pwsh -File ../PowershellScripts/CopyFile.ps1 $(TargetPath) ../Fonlow.OpenApiClientGen/$(OutDir)" />
22-
</Target>
20+
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
21+
<Exec Command="pwsh -File ../PowershellScripts/CopyFile.ps1 $(TargetPath) ../Fonlow.OpenApiClientGen/$(OutDir)" />
22+
</Target>
2323

2424
</Project>

OpenApiClientGenCore.Axios/OpenApiClientGenCore.Axios.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<AssemblyName>Fonlow.OpenApiClientGen.Axios</AssemblyName>
66
<RootNamespace>Fonlow.OpenApiClientGen.Axios</RootNamespace>
77
<Authors>Zijian Huang</Authors>
8-
<Copyright>Copyright © Zijian Huang 2021-2024</Copyright>
8+
<Copyright>Copyright © Zijian Huang 2021-$([System.DateTime]::Now.Year)</Copyright>
99
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1010
<PackageProjectUrl>https://github.com/zijianhuang/openapiclientgen</PackageProjectUrl>
1111
<NeutralLanguage>en</NeutralLanguage>

OpenApiClientGenCore.Fetch/ClientApiTsFetchFunctionGen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ string GetOptionsWithContent()
117117
string uriText = jsUriQuery == null ? $"this.baseUri + '{RelativePath}'" : RemoveTrialEmptyString($"this.baseUri + '{jsUriQuery}'");
118118
#pragma warning restore CA1508 // Avoid dead conditional code
119119

120-
if (ReturnTypeReference != null && ReturnTypeReference.BaseType.Contains("String", StringComparison.OrdinalIgnoreCase) && ReturnTypeReference.ArrayElementType == null)//stringAsString is for .NET Core Web API
120+
if (ReturnTypeReference != null && ReturnTypeReference.BaseType=="System.String" && ReturnTypeReference.ArrayElementType == null)//stringAsString is for .NET Core Web API
121121
{
122122
if (HttpMethodName == "get" || HttpMethodName == "delete")
123123
{

OpenApiClientGenCore.Fetch/OpenApiClientGenCore.Fetch.csproj

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
5-
<AssemblyName>Fonlow.OpenApiClientGen.Fetch</AssemblyName>
6-
<Authors>Zijian Huang</Authors>
7-
<Copyright>Copyright © Zijian Huang 2020-2024</Copyright>
8-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
9-
<PackageProjectUrl>https://github.com/zijianhuang/openapiclientgen</PackageProjectUrl>
10-
<NeutralLanguage>en</NeutralLanguage>
11-
<Version>2.3</Version>
12-
<AnalysisLevel>latest-all</AnalysisLevel>
13-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<AssemblyName>Fonlow.OpenApiClientGen.Fetch</AssemblyName>
6+
<Authors>Zijian Huang</Authors>
7+
<Copyright>Copyright © Zijian Huang 2021-$([System.DateTime]::Now.Year)</Copyright>
8+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
9+
<PackageProjectUrl>https://github.com/zijianhuang/openapiclientgen</PackageProjectUrl>
10+
<NeutralLanguage>en</NeutralLanguage>
11+
<Version>2.3.1</Version>
12+
<AnalysisLevel>latest-all</AnalysisLevel>
13+
</PropertyGroup>
1414

15-
<ItemGroup>
16-
<ProjectReference Include="..\Fonlow.OpenApiClientGen.Abstract\Fonlow.OpenApiClientGen.Abstract.csproj" />
17-
</ItemGroup>
15+
<ItemGroup>
16+
<ProjectReference Include="..\Fonlow.OpenApiClientGen.Abstract\Fonlow.OpenApiClientGen.Abstract.csproj" />
17+
</ItemGroup>
1818

1919
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
2020
<Exec Command="pwsh -File ../PowershellScripts/CopyFile.ps1 $(TargetPath) ../Fonlow.OpenApiClientGen/$(OutDir)" />
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
5-
<AssemblyName>Fonlow.OpenApiClientGen.JQ</AssemblyName>
6-
<RootNamespace>Fonlow.OpenApiClientGen.JQ</RootNamespace>
7-
<Authors>Zijian Huang</Authors>
8-
<Copyright>Copyright © Zijian Huang 2021-2024</Copyright>
9-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
10-
<PackageProjectUrl>https://github.com/zijianhuang/openapiclientgen</PackageProjectUrl>
11-
<NeutralLanguage>en</NeutralLanguage>
12-
<Version>2.1</Version>
13-
<AnalysisLevel>latest-all</AnalysisLevel>
14-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<AssemblyName>Fonlow.OpenApiClientGen.JQ</AssemblyName>
6+
<RootNamespace>Fonlow.OpenApiClientGen.JQ</RootNamespace>
7+
<Authors>Zijian Huang</Authors>
8+
<Copyright>Copyright © Zijian Huang 2021-$([System.DateTime]::Now.Year)</Copyright>
9+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
10+
<PackageProjectUrl>https://github.com/zijianhuang/openapiclientgen</PackageProjectUrl>
11+
<NeutralLanguage>en</NeutralLanguage>
12+
<Version>2.1</Version>
13+
<AnalysisLevel>latest-all</AnalysisLevel>
14+
</PropertyGroup>
1515

1616
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
1717
<Exec Command="pwsh -File ../PowershellScripts/CopyFile.ps1 $(TargetPath) ../Fonlow.OpenApiClientGen/$(OutDir)" />
1818
</Target>
1919

20-
<ItemGroup>
21-
<ProjectReference Include="..\Fonlow.OpenApiClientGen.Abstract\Fonlow.OpenApiClientGen.Abstract.csproj" />
22-
</ItemGroup>
20+
<ItemGroup>
21+
<ProjectReference Include="..\Fonlow.OpenApiClientGen.Abstract\Fonlow.OpenApiClientGen.Abstract.csproj" />
22+
</ItemGroup>
2323

2424
</Project>

OpenApiClientGenCore.NG2/OpenApiClientGenCore.NG2.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
88
<PackageLicenseExpression>MIT</PackageLicenseExpression>
99
<PackageProjectUrl>https://github.com/zijianhuang/openapiclientgen</PackageProjectUrl>
10-
<Copyright>Copyright © Zijian Huang 2021-2024</Copyright>
10+
<Copyright>Copyright © Zijian Huang 2021-$([System.DateTime]::Now.Year)</Copyright>
1111
<Authors>Zijian Huang</Authors>
1212
<RootNamespace>Fonlow.OpenApiClientGen.NG2</RootNamespace>
1313
<Version>2.1</Version>

Tests/SwagTsTests/AxiosResults/Pet.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export namespace MyNS {
219219
* @return {Pet} successful operation
220220
*/
221221
GetPetById(petId: string): Promise<Pet> {
222-
return Axios.get<Pet>(this.baseUri + 'pet/' + petId, {}).then(d => {if (d.status<=204) return d.data); throw d;});
222+
return Axios.get<Pet>(this.baseUri + 'pet/' + petId, {}).then(d => {if (d.status<=204) return d.data; throw d;});
223223
}
224224

225225
/**
@@ -242,7 +242,7 @@ export namespace MyNS {
242242
* @return {Array<Pet>} successful operation
243243
*/
244244
FindPetsByStatus(status: Array<PetStatus>): Promise<Array<Pet>> {
245-
return Axios.get<Array<Pet>>(this.baseUri + 'pet/findByStatus?' + status.map(z => `status=${z}`).join('&'), {}).then(d => {if (d.status<=204) return d.data); throw d;});
245+
return Axios.get<Array<Pet>>(this.baseUri + 'pet/findByStatus?' + status.map(z => `status=${z}`).join('&'), {}).then(d => {if (d.status<=204) return d.data; throw d;});
246246
}
247247

248248
/**
@@ -253,7 +253,7 @@ export namespace MyNS {
253253
* @return {Array<Pet>} successful operation
254254
*/
255255
FindPetsByTags(tags: Array<string>): Promise<Array<Pet>> {
256-
return Axios.get<Array<Pet>>(this.baseUri + 'pet/findByTags?' + tags.map(z => `tags=${encodeURIComponent(z)}`).join('&'), {}).then(d => {if (d.status<=204) return d.data); throw d;});
256+
return Axios.get<Array<Pet>>(this.baseUri + 'pet/findByTags?' + tags.map(z => `tags=${encodeURIComponent(z)}`).join('&'), {}).then(d => {if (d.status<=204) return d.data; throw d;});
257257
}
258258
}
259259

@@ -268,7 +268,7 @@ export namespace MyNS {
268268
* @return {{[id: string]: number }} successful operation
269269
*/
270270
GetInventory(): Promise<{[id: string]: number }> {
271-
return Axios.get<{[id: string]: number }>(this.baseUri + 'store/inventory', {}).then(d => {if (d.status<=204) return d.data); throw d;});
271+
return Axios.get<{[id: string]: number }>(this.baseUri + 'store/inventory', {}).then(d => {if (d.status<=204) return d.data; throw d;});
272272
}
273273

274274
/**
@@ -278,7 +278,7 @@ export namespace MyNS {
278278
* @return {Order} successful operation
279279
*/
280280
PlaceOrder(requestBody: Order): Promise<Order> {
281-
return Axios.post<Order>(this.baseUri + 'store/order', JSON.stringify(requestBody), { headers: { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data); throw d;});
281+
return Axios.post<Order>(this.baseUri + 'store/order', JSON.stringify(requestBody), { headers: { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data; throw d;});
282282
}
283283

284284
/**
@@ -290,7 +290,7 @@ export namespace MyNS {
290290
* @return {Order} successful operation
291291
*/
292292
GetOrderById(orderId: string): Promise<Order> {
293-
return Axios.get<Order>(this.baseUri + 'store/order/' + orderId, {}).then(d => {if (d.status<=204) return d.data); throw d;});
293+
return Axios.get<Order>(this.baseUri + 'store/order/' + orderId, {}).then(d => {if (d.status<=204) return d.data; throw d;});
294294
}
295295

296296
/**
@@ -328,7 +328,7 @@ export namespace MyNS {
328328
* @return {User} successful operation
329329
*/
330330
GetUserByName(username: string): Promise<User> {
331-
return Axios.get<User>(this.baseUri + 'user/' + (username == null ? '' : encodeURIComponent(username)), {}).then(d => {if (d.status<=204) return d.data); throw d;});
331+
return Axios.get<User>(this.baseUri + 'user/' + (username == null ? '' : encodeURIComponent(username)), {}).then(d => {if (d.status<=204) return d.data; throw d;});
332332
}
333333

334334
/**
@@ -382,7 +382,7 @@ export namespace MyNS {
382382
* @return {string} successful operation
383383
*/
384384
LoginUser(username: string, password: string): Promise<string> {
385-
return Axios.get(this.baseUri + 'user/login?username=' + (username == null ? '' : encodeURIComponent(username)) + '&password=' + (password == null ? '' : encodeURIComponent(password)), { responseType: 'text' }).then(d => {if (d.status<=204) return d.data); throw d;});
385+
return Axios.get(this.baseUri + 'user/login?username=' + (username == null ? '' : encodeURIComponent(username)) + '&password=' + (password == null ? '' : encodeURIComponent(password)), { responseType: 'text' }).then(d => {if (d.status<=204) return d.data; throw d;});
386386
}
387387

388388
/**

Tests/SwagTsTests/AxiosResults/PetFindByStatus.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export namespace MyNS {
9393
* @return {Array<Pet>} successful operation
9494
*/
9595
FindPetsByStatus(status: Array<PetStatus>): Promise<Array<Pet>> {
96-
return Axios.get<Array<Pet>>(this.baseUri + 'pet/findByStatus?' + status.map(z => `status=${z}`).join('&'), {}).then(d => {if (d.status<=204) return d.data); throw d;});
96+
return Axios.get<Array<Pet>>(this.baseUri + 'pet/findByStatus?' + status.map(z => `status=${z}`).join('&'), {}).then(d => {if (d.status<=204) return d.data; throw d;});
9797
}
9898

9999
/**
@@ -104,7 +104,7 @@ export namespace MyNS {
104104
* @return {Array<Pet>} successful operation
105105
*/
106106
FindPetsByStatus2(status: PetStatus): Promise<Array<Pet>> {
107-
return Axios.get<Array<Pet>>(this.baseUri + 'pet/findByStatus2?status=' + status, {}).then(d => {if (d.status<=204) return d.data); throw d;});
107+
return Axios.get<Array<Pet>>(this.baseUri + 'pet/findByStatus2?status=' + status, {}).then(d => {if (d.status<=204) return d.data; throw d;});
108108
}
109109

110110
/**
@@ -115,7 +115,7 @@ export namespace MyNS {
115115
* @return {Array<Pet>} successful operation
116116
*/
117117
FindPetsByStatus3(status: PetStatus): Promise<Array<Pet>> {
118-
return Axios.get<Array<Pet>>(this.baseUri + 'pet/findByStatus3?status=' + status, {}).then(d => {if (d.status<=204) return d.data); throw d;});
118+
return Axios.get<Array<Pet>>(this.baseUri + 'pet/findByStatus3?status=' + status, {}).then(d => {if (d.status<=204) return d.data; throw d;});
119119
}
120120
}
121121

Tests/SwagTsTests/AxiosResults/PetGodClass.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export namespace MyNS {
170170
* @return {Pet} successful operation
171171
*/
172172
Pet_petIdGet(petId: string): Promise<Pet> {
173-
return Axios.get<Pet>(this.baseUri + 'pet/' + petId, {}).then(d => {if (d.status<=204) return d.data); throw d;});
173+
return Axios.get<Pet>(this.baseUri + 'pet/' + petId, {}).then(d => {if (d.status<=204) return d.data; throw d;});
174174
}
175175

176176
/**
@@ -191,7 +191,7 @@ export namespace MyNS {
191191
* @return {Array<Pet>} successful operation
192192
*/
193193
PetFindByStatusGetByStatus(status: Array<PetStatus>): Promise<Array<Pet>> {
194-
return Axios.get<Array<Pet>>(this.baseUri + 'pet/findByStatus?' + status.map(z => `status=${z}`).join('&'), {}).then(d => {if (d.status<=204) return d.data); throw d;});
194+
return Axios.get<Array<Pet>>(this.baseUri + 'pet/findByStatus?' + status.map(z => `status=${z}`).join('&'), {}).then(d => {if (d.status<=204) return d.data; throw d;});
195195
}
196196

197197
/**
@@ -202,7 +202,7 @@ export namespace MyNS {
202202
* @return {Array<Pet>} successful operation
203203
*/
204204
PetFindByTagsGetByTags(tags: Array<string>): Promise<Array<Pet>> {
205-
return Axios.get<Array<Pet>>(this.baseUri + 'pet/findByTags?' + tags.map(z => `tags=${encodeURIComponent(z)}`).join('&'), {}).then(d => {if (d.status<=204) return d.data); throw d;});
205+
return Axios.get<Array<Pet>>(this.baseUri + 'pet/findByTags?' + tags.map(z => `tags=${encodeURIComponent(z)}`).join('&'), {}).then(d => {if (d.status<=204) return d.data; throw d;});
206206
}
207207

208208
/**
@@ -212,7 +212,7 @@ export namespace MyNS {
212212
* @return {{[id: string]: number }} successful operation
213213
*/
214214
StoreInventoryGet(): Promise<{[id: string]: number }> {
215-
return Axios.get<{[id: string]: number }>(this.baseUri + 'store/inventory', {}).then(d => {if (d.status<=204) return d.data); throw d;});
215+
return Axios.get<{[id: string]: number }>(this.baseUri + 'store/inventory', {}).then(d => {if (d.status<=204) return d.data; throw d;});
216216
}
217217

218218
/**
@@ -222,7 +222,7 @@ export namespace MyNS {
222222
* @return {Order} successful operation
223223
*/
224224
StoreOrderPost(requestBody: Order): Promise<Order> {
225-
return Axios.post<Order>(this.baseUri + 'store/order', JSON.stringify(requestBody), { headers: { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data); throw d;});
225+
return Axios.post<Order>(this.baseUri + 'store/order', JSON.stringify(requestBody), { headers: { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data; throw d;});
226226
}
227227

228228
/**
@@ -233,7 +233,7 @@ export namespace MyNS {
233233
* @return {Order} successful operation
234234
*/
235235
StoreOrder_orderIdGet(orderId: string): Promise<Order> {
236-
return Axios.get<Order>(this.baseUri + 'store/order/' + orderId, {}).then(d => {if (d.status<=204) return d.data); throw d;});
236+
return Axios.get<Order>(this.baseUri + 'store/order/' + orderId, {}).then(d => {if (d.status<=204) return d.data; throw d;});
237237
}
238238

239239
/**
@@ -265,7 +265,7 @@ export namespace MyNS {
265265
* @return {User} successful operation
266266
*/
267267
User_usernameGet(username: string): Promise<User> {
268-
return Axios.get<User>(this.baseUri + 'user/' + (username == null ? '' : encodeURIComponent(username)), {}).then(d => {if (d.status<=204) return d.data); throw d;});
268+
return Axios.get<User>(this.baseUri + 'user/' + (username == null ? '' : encodeURIComponent(username)), {}).then(d => {if (d.status<=204) return d.data; throw d;});
269269
}
270270

271271
/**
@@ -319,7 +319,7 @@ export namespace MyNS {
319319
* @return {string} successful operation
320320
*/
321321
UserLoginGetByUsernameAndPassword(username: string, password: string): Promise<string> {
322-
return Axios.get(this.baseUri + 'user/login?username=' + (username == null ? '' : encodeURIComponent(username)) + '&password=' + (password == null ? '' : encodeURIComponent(password)), { responseType: 'text' }).then(d => {if (d.status<=204) return d.data); throw d;});
322+
return Axios.get(this.baseUri + 'user/login?username=' + (username == null ? '' : encodeURIComponent(username)) + '&password=' + (password == null ? '' : encodeURIComponent(password)), { responseType: 'text' }).then(d => {if (d.status<=204) return d.data; throw d;});
323323
}
324324

325325
/**

0 commit comments

Comments
 (0)