Fix: When generated TS class name is "Error", it is conflicting with TS Error class #778
Annotations
6 errors and 10 warnings
Run: Compile, Test, Pack
[xUnit.net 00:00:08.65] NSwag.ConsoleCore.Tests.GenerateSampleSpecificationTests.Should_generate_openapi_for_project(projectName: "NSwag.Sample.NET90Minimal", targetFramework: "net9.0", generatesCode: True) [FAIL]
|
Run: Compile, Test, Pack
VerifyException : Directory: D:\a\NSwag\NSwag\src\NSwag.ConsoleCore.Tests
NotEqual:
- Received: GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET90Minimal_targetFramework=net9.0_generatesCode=True.received.txt
Verified: GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET90Minimal_targetFramework=net9.0_generatesCode=True.verified.txt
FileContent:
NotEqual:
Received: GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET90Minimal_targetFramework=net9.0_generatesCode=True.received.txt
//----------------------
// <auto-generated>
// Generated using the NSwag toolchain v (http://NSwag.org)
// </auto-generated>
//----------------------
/* tslint:disable */
/* eslint-disable */
// ReSharper disable InconsistentNaming
export class Client {
private http: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> };
private baseUrl: string;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> }) {
this.http = http ? http : window as any;
this.baseUrl = baseUrl ?? "";
}
get(): Promise<string> {
let url_ = this.baseUrl + "/";
url_ = url_.replace(/[?&]$/, "");
let options_: RequestInit = {
method: "GET",
headers: {
"Accept": "application/json"
}
};
return this.http.fetch(url_, options_).then((_response: Response) => {
return this.processGet(_response);
});
}
protected processGet(response: Response): Promise<string> {
const status = response.status;
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
if (status === 200) {
return response.text().then((_responseText) => {
let result200: any = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result200 = resultData200 !== undefined ? resultData200 : <any>null;
return result200;
});
} else if (status !== 200 && status !== 204) {
return response.text().then((_responseText) => {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
});
}
return Promise.resolve<string>(null as any);
}
calculateSum(a: number, b: number): Promise<number> {
let url_ = this.baseUrl + "/sum/{a}/{b}";
if (a === undefined || a === null)
throw new global.Error("The parameter 'a' must be defined.");
url_ = url_.replace("{a}", encodeURIComponent("" + a));
if (b === undefined || b === null)
throw new global.Error("The parameter 'b' must be defined.");
url_ = url_.replace("{b}", encodeURIComponent("" + b));
url_ = url_.replace(/[?&]$/, "");
let options_: RequestInit = {
method: "GET",
headers: {
"Accept": "application/json"
}
};
return this.http.fetch(url_, options_).then((_response: Response) => {
return this.processCalculateSum(_response);
});
}
protected processCalculateSum(response: Response): Promise<number> {
const status = response.status;
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
if (status === 200) {
return response.text().then((_responseText) => {
let result200: any = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result200 = resultData200 !== undefined ? resultData200 : <any>null;
return result200;
});
}
|
Run: Compile, Test, Pack
[xUnit.net 00:00:20.27] NSwag.ConsoleCore.Tests.GenerateSampleSpecificationTests.Should_generate_openapi_for_project(projectName: "NSwag.Sample.NET80Minimal", targetFramework: "net8.0", generatesCode: True) [FAIL]
|
Run: Compile, Test, Pack
VerifyException : Directory: D:\a\NSwag\NSwag\src\NSwag.ConsoleCore.Tests
NotEqual:
- Received: GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET80Minimal_targetFramework=net8.0_generatesCode=True.received.txt
Verified: GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET80Minimal_targetFramework=net8.0_generatesCode=True.verified.txt
FileContent:
NotEqual:
Received: GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET80Minimal_targetFramework=net8.0_generatesCode=True.received.txt
//----------------------
// <auto-generated>
// Generated using the NSwag toolchain v (http://NSwag.org)
// </auto-generated>
//----------------------
/* tslint:disable */
/* eslint-disable */
// ReSharper disable InconsistentNaming
export class Client {
private http: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> };
private baseUrl: string;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> }) {
this.http = http ? http : window as any;
this.baseUrl = baseUrl ?? "";
}
get(): Promise<string> {
let url_ = this.baseUrl + "/";
url_ = url_.replace(/[?&]$/, "");
let options_: RequestInit = {
method: "GET",
headers: {
"Accept": "application/json"
}
};
return this.http.fetch(url_, options_).then((_response: Response) => {
return this.processGet(_response);
});
}
protected processGet(response: Response): Promise<string> {
const status = response.status;
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
if (status === 200) {
return response.text().then((_responseText) => {
let result200: any = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result200 = resultData200 !== undefined ? resultData200 : <any>null;
return result200;
});
} else if (status !== 200 && status !== 204) {
return response.text().then((_responseText) => {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
});
}
return Promise.resolve<string>(null as any);
}
calculateSum(a: number, b: number): Promise<number> {
let url_ = this.baseUrl + "/sum/{a}/{b}";
if (a === undefined || a === null)
throw new global.Error("The parameter 'a' must be defined.");
url_ = url_.replace("{a}", encodeURIComponent("" + a));
if (b === undefined || b === null)
throw new global.Error("The parameter 'b' must be defined.");
url_ = url_.replace("{b}", encodeURIComponent("" + b));
url_ = url_.replace(/[?&]$/, "");
let options_: RequestInit = {
method: "GET",
headers: {
"Accept": "application/json"
}
};
return this.http.fetch(url_, options_).then((_response: Response) => {
return this.processCalculateSum(_response);
});
}
protected processCalculateSum(response: Response): Promise<number> {
const status = response.status;
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
if (status === 200) {
return response.text().then((_responseText) => {
let result200: any = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result200 = resultData200 !== undefined ? resultData200 : <any>null;
return result200;
});
}
|
Run: Compile, Test, Pack
Target "Test" has thrown an exception
|
Run: Compile, Test, Pack
Process completed with exit code 1.
|
Run: Compile, Test, Pack
D:\a\NSwag\NSwag\src\NSwagStudio.Installer\NSwagStudio.Installer.wixproj : warning NU1503: Skipping restore for project 'D:\a\NSwag\NSwag\src\NSwagStudio.Installer\NSwagStudio.Installer.wixproj'. The project file may be invalid or missing targets required for restore. [D:\a\NSwag\NSwag\src\NSwag.sln]
|
Run: Compile, Test, Pack
D:\a\NSwag\NSwag\src\NSwag.Generation.AspNetCore.Tests\NSwag.Generation.AspNetCore.Tests.csproj : warning NU1903: Package 'System.Net.Http' 4.3.0 has a known high severity vulnerability, https://github.com/advisories/GHSA-7jgj-8wvc-jh57 [D:\a\NSwag\NSwag\src\NSwag.sln]
|
Run: Compile, Test, Pack
D:\a\NSwag\NSwag\src\NSwag.Generation.AspNetCore.Tests\NSwag.Generation.AspNetCore.Tests.csproj : warning NU1903: Package 'System.Text.RegularExpressions' 4.3.0 has a known high severity vulnerability, https://github.com/advisories/GHSA-cmhx-cq75-c4mj [D:\a\NSwag\NSwag\src\NSwag.sln]
|
Run: Compile, Test, Pack
D:\a\NSwag\NSwag\src\NSwag.Generation.AspNetCore\NSwag.Generation.AspNetCore.csproj : warning NU1903: Package 'Microsoft.AspNetCore.Http' 1.0.4 has a known high severity vulnerability, https://github.com/advisories/GHSA-hxrm-9w7p-39cc [D:\a\NSwag\NSwag\src\NSwag.sln]
|
Run: Compile, Test, Pack
D:\a\NSwag\NSwag\src\NSwag.AspNetCore\NSwag.AspNetCore.csproj : warning NU1903: Package 'Microsoft.AspNetCore.Http' 1.0.4 has a known high severity vulnerability, https://github.com/advisories/GHSA-hxrm-9w7p-39cc [D:\a\NSwag\NSwag\src\NSwag.sln]
|
Run: Compile, Test, Pack
D:\a\NSwag\NSwag\src\NSwag.ConsoleCore\NSwag.ConsoleCore.csproj : warning NU1903: Package 'System.Text.Json' 8.0.0 has a known high severity vulnerability, https://github.com/advisories/GHSA-8g4q-xg66-9fp4 [D:\a\NSwag\NSwag\src\NSwag.sln]
|
Run: Compile, Test, Pack
D:\a\NSwag\NSwag\src\NSwag.ConsoleCore\NSwag.ConsoleCore.csproj : warning NU1903: Package 'System.Text.Json' 8.0.0 has a known high severity vulnerability, https://github.com/advisories/GHSA-hh2w-p6rv-4g7w [D:\a\NSwag\NSwag\src\NSwag.sln]
|
Run: Compile, Test, Pack
D:\a\NSwag\NSwag\src\NSwag.ConsoleCore\NSwag.ConsoleCore.csproj : warning NU1903: Package 'System.Text.RegularExpressions' 4.3.0 has a known high severity vulnerability, https://github.com/advisories/GHSA-cmhx-cq75-c4mj [D:\a\NSwag\NSwag\src\NSwag.sln]
|
Run: Compile, Test, Pack
D:\a\NSwag\NSwag\src\NSwag.Commands\NSwag.Commands.csproj : warning NU1903: Package 'System.Net.Http' 4.3.0 has a known high severity vulnerability, https://github.com/advisories/GHSA-7jgj-8wvc-jh57 [D:\a\NSwag\NSwag\src\NSwag.sln]
|
Run: Compile, Test, Pack
D:\a\NSwag\NSwag\src\NSwag.Commands\NSwag.Commands.csproj : warning NU1903: Package 'System.Text.Json' 8.0.0 has a known high severity vulnerability, https://github.com/advisories/GHSA-8g4q-xg66-9fp4 [D:\a\NSwag\NSwag\src\NSwag.sln]
|
Loading