Skip to content

Fix analysis warnings in tests #315

Fix analysis warnings in tests

Fix analysis warnings in tests #315

Triggered via pull request November 23, 2024 13:18
Status Failure
Total duration 4m 43s
Artifacts

pr.yml

on: pull_request
Fit to window
Zoom out
Zoom in

Annotations

20 errors
ubuntu-latest
[xUnit.net 00:00:01.61] NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: KnockoutClass, version: 4.3) [FAIL]
ubuntu-latest
[xUnit.net 00:00:01.66] NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: Interface, version: 1.8) [FAIL]
NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: KnockoutClass
VerifyException : Directory: /home/runner/work/NJsonSchema/NJsonSchema/src/NJsonSchema.CodeGeneration.TypeScript.Tests New: - Received: ClassGenerationTests.Verify_output_style=KnockoutClass_version=4.3.DotNet8_0.received.txt Verified: ClassGenerationTests.Verify_output_style=KnockoutClass_version=4.3.verified.txt FileContent: New: Received: ClassGenerationTests.Verify_output_style=KnockoutClass_version=4.3.DotNet8_0.received.txt //---------------------- // <auto-generated> // Generated using the NSwag toolchain v11.0.0.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // </auto-generated> //---------------------- export class Person { firstName = ko.observable<string | undefined>(); lastName = ko.observable<string | undefined>(); init(data?: any) { if (data !== undefined) { var firstName_: any; firstName_ = _data["FirstName"]; this.firstName(firstName_); var lastName_: any; lastName_ = _data["LastName"]; this.lastName(lastName_); } } static fromJS(data: any): Person { let result = new Person(); result.init(data); return result; } toJSON(data?: any) { data = typeof data === 'object' ? data : {}; let firstName_: any = this.firstName(); data["FirstName"] = firstName_; let lastName_: any = this.lastName(); data["LastName"] = lastName_; return data; } } export class Student extends Person { study = ko.observable<string | undefined>(); override init(data?: any) { super.init(data); if (data !== undefined) { var study_: any; study_ = _data["Study"]; this.study(study_); } } static override fromJS(data: any): Student { let result = new Student(); result.init(data); return result; } override toJSON(data?: any) { data = typeof data === 'object' ? data : {}; let study_: any = this.study(); data["Study"] = study_; super.toJSON(data); return data; } } export class MyClass { name = ko.observable<string | undefined>("foo"); dateOfBirth = ko.observable<Date>(); primitiveArray = ko.observableArray<number>(); primitiveDictionary = ko.observable<{ [key: string]: number; } | undefined>(); dateArray = ko.observableArray<Date>(); dateDictionary = ko.observable<{ [key: string]: Date; } | undefined>(); reference = ko.observable<Student | undefined>(); array = ko.observableArray<Student>(); dictionary = ko.observable<{ [key: string]: Student; } | undefined>(); init(data?: any) { if (data !== undefined) { var name_: any; name_ = _data["Name"] !== undefined ? _data["Name"] : "foo"; this.name(name_); var dateOfBirth_: any; dateOfBirth_ = _data["DateOfBirth"] ? new Date(_data["DateOfBirth"].toString()) : <any>undefined; this.dateOfBirth(dateOfBirth_); var primitiveArray_: any; if (Array.isArray(_data["PrimitiveArray"])) { primitiveArray_ = [] as any; for (let item of _data["PrimitiveArray"]) primitiveArray_!.push(item); } this.primitiveArray(primitiveArray_); var primitiveDictionary_: any; if (_data["PrimitiveDictionary"]) { primitiveDictionary_ = {} as any; for (let key in _data["PrimitiveDictionary"]) { if (_data["PrimitiveDictionary"].hasOwnProperty(key)) (<any>primitiveDictionary_)![key] = _data["PrimitiveDictionary"][key]; } } this.primitiveDictionary(primitiveDictionary_); var dateArray_: any; if (Array.isArray(_data["DateArray"])) { dateArray_ = [] as any; for (let item of _data["DateArray"]) dateArray_!.push(
NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: Interface
VerifyException : Directory: /home/runner/work/NJsonSchema/NJsonSchema/src/NJsonSchema.CodeGeneration.TypeScript.Tests New: - Received: ClassGenerationTests.Verify_output_style=Interface_version=1.8.DotNet8_0.received.txt Verified: ClassGenerationTests.Verify_output_style=Interface_version=1.8.verified.txt FileContent: New: Received: ClassGenerationTests.Verify_output_style=Interface_version=1.8.DotNet8_0.received.txt //---------------------- // <auto-generated> // Generated using the NSwag toolchain v11.0.0.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // </auto-generated> //---------------------- export interface Person { FirstName: string; LastName: string; } export interface Student extends Person { Study: string; } export interface MyClass { Name: string; DateOfBirth: Date; PrimitiveArray: number[]; PrimitiveDictionary: { [key: string]: number; }; DateArray: Date[]; DateDictionary: { [key: string]: Date; }; Reference: Student; Array: Student[]; Dictionary: { [key: string]: Student; }; }
ubuntu-latest
[xUnit.net 00:00:01.66] NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: KnockoutClass, version: 2.7) [FAIL]
ubuntu-latest
[xUnit.net 00:00:01.69] NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: Class, version: 1.8) [FAIL]
ubuntu-latest
[xUnit.net 00:00:01.73] NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: Interface, version: 4.3) [FAIL]
NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: KnockoutClass
VerifyException : Directory: /home/runner/work/NJsonSchema/NJsonSchema/src/NJsonSchema.CodeGeneration.TypeScript.Tests New: - Received: ClassGenerationTests.Verify_output_style=KnockoutClass_version=2.7.DotNet8_0.received.txt Verified: ClassGenerationTests.Verify_output_style=KnockoutClass_version=2.7.verified.txt FileContent: New: Received: ClassGenerationTests.Verify_output_style=KnockoutClass_version=2.7.DotNet8_0.received.txt //---------------------- // <auto-generated> // Generated using the NSwag toolchain v11.0.0.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // </auto-generated> //---------------------- export class Person { firstName = ko.observable<string | undefined>(); lastName = ko.observable<string | undefined>(); init(data?: any) { if (data !== undefined) { var firstName_: any; firstName_ = _data["FirstName"]; this.firstName(firstName_); var lastName_: any; lastName_ = _data["LastName"]; this.lastName(lastName_); } } static fromJS(data: any): Person { let result = new Person(); result.init(data); return result; } toJSON(data?: any) { data = typeof data === 'object' ? data : {}; let firstName_: any = this.firstName(); data["FirstName"] = firstName_; let lastName_: any = this.lastName(); data["LastName"] = lastName_; return data; } } export class Student extends Person { study = ko.observable<string | undefined>(); init(data?: any) { super.init(data); if (data !== undefined) { var study_: any; study_ = _data["Study"]; this.study(study_); } } static fromJS(data: any): Student { let result = new Student(); result.init(data); return result; } toJSON(data?: any) { data = typeof data === 'object' ? data : {}; let study_: any = this.study(); data["Study"] = study_; super.toJSON(data); return data; } } export class MyClass { name = ko.observable<string | undefined>("foo"); dateOfBirth = ko.observable<Date>(); primitiveArray = ko.observableArray<number>(); primitiveDictionary = ko.observable<{ [key: string]: number; } | undefined>(); dateArray = ko.observableArray<Date>(); dateDictionary = ko.observable<{ [key: string]: Date; } | undefined>(); reference = ko.observable<Student | undefined>(); array = ko.observableArray<Student>(); dictionary = ko.observable<{ [key: string]: Student; } | undefined>(); init(data?: any) { if (data !== undefined) { var name_: any; name_ = _data["Name"] !== undefined ? _data["Name"] : "foo"; this.name(name_); var dateOfBirth_: any; dateOfBirth_ = _data["DateOfBirth"] ? new Date(_data["DateOfBirth"].toString()) : <any>undefined; this.dateOfBirth(dateOfBirth_); var primitiveArray_: any; if (Array.isArray(_data["PrimitiveArray"])) { primitiveArray_ = [] as any; for (let item of _data["PrimitiveArray"]) primitiveArray_!.push(item); } this.primitiveArray(primitiveArray_); var primitiveDictionary_: any; if (_data["PrimitiveDictionary"]) { primitiveDictionary_ = {} as any; for (let key in _data["PrimitiveDictionary"]) { if (_data["PrimitiveDictionary"].hasOwnProperty(key)) (<any>primitiveDictionary_)![key] = _data["PrimitiveDictionary"][key]; } } this.primitiveDictionary(primitiveDictionary_); var dateArray_: any; if (Array.isArray(_data["DateArray"])) { dateArray_ = [] as any; for (let item of _data["DateArray"]) dateArray_!.push(new Date(item));
NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: Class
VerifyException : Directory: /home/runner/work/NJsonSchema/NJsonSchema/src/NJsonSchema.CodeGeneration.TypeScript.Tests New: - Received: ClassGenerationTests.Verify_output_style=Class_version=1.8.DotNet8_0.received.txt Verified: ClassGenerationTests.Verify_output_style=Class_version=1.8.verified.txt FileContent: New: Received: ClassGenerationTests.Verify_output_style=Class_version=1.8.DotNet8_0.received.txt //---------------------- // <auto-generated> // Generated using the NSwag toolchain v11.0.0.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // </auto-generated> //---------------------- export class Person implements IPerson { firstName: string; lastName: string; constructor(data?: IPerson) { if (data) { for (var property in data) { if (data.hasOwnProperty(property)) (<any>this)[property] = (<any>data)[property]; } } } init(_data?: any) { if (_data) { this.firstName = _data["FirstName"]; this.lastName = _data["LastName"]; } } static fromJS(data: any): Person { data = typeof data === 'object' ? data : {}; let result = new Person(); result.init(data); return result; } toJSON(data?: any) { data = typeof data === 'object' ? data : {}; data["FirstName"] = this.firstName; data["LastName"] = this.lastName; return data; } } export interface IPerson { firstName: string; lastName: string; } export class Student extends Person implements IStudent { study: string; constructor(data?: IStudent) { super(data); } init(_data?: any) { super.init(_data); if (_data) { this.study = _data["Study"]; } } static fromJS(data: any): Student { data = typeof data === 'object' ? data : {}; let result = new Student(); result.init(data); return result; } toJSON(data?: any) { data = typeof data === 'object' ? data : {}; data["Study"] = this.study; super.toJSON(data); return data; } } export interface IStudent extends IPerson { study: string; } export class MyClass implements IMyClass { name: string; dateOfBirth: Date; primitiveArray: number[]; primitiveDictionary: { [key: string]: number; }; dateArray: Date[]; dateDictionary: { [key: string]: Date; }; reference: Student; array: Student[]; dictionary: { [key: string]: Student; }; constructor(data?: IMyClass) { if (data) { for (var property in data) { if (data.hasOwnProperty(property)) (<any>this)[property] = (<any>data)[property]; } } if (!data) { this.name = "foo"; } } init(_data?: any) { if (_data) { this.name = _data["Name"] !== undefined ? _data["Name"] : "foo"; this.dateOfBirth = _data["DateOfBirth"] ? new Date(_data["DateOfBirth"].toString()) : <any>undefined; if (Array.isArray(_data["PrimitiveArray"])) { this.primitiveArray = [] as any; for (let item of _data["PrimitiveArray"]) this.primitiveArray.push(item); } if (_data["PrimitiveDictionary"]) { this.primitiveDictionary = {} as any; for (let key in _data["PrimitiveDictionary"]) { if (_data["PrimitiveDictionary"].hasOwnProperty(key)) (<any>this.primitiveDictionary)[key] = _data["PrimitiveDictionary"][key]; } } if (Array.isArray(_data["DateArray"])) { this.dateArray = [] as any; for (let item of _data["DateArray"]) this.dateArray.push(new Date(item)); } if (_data["DateDictionary"]) { this.dateDictionary = {} as any; for (let key in _data["DateDictiona
NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: Interface
VerifyException : Directory: /home/runner/work/NJsonSchema/NJsonSchema/src/NJsonSchema.CodeGeneration.TypeScript.Tests New: - Received: ClassGenerationTests.Verify_output_style=Interface_version=4.3.DotNet8_0.received.txt Verified: ClassGenerationTests.Verify_output_style=Interface_version=4.3.verified.txt FileContent: New: Received: ClassGenerationTests.Verify_output_style=Interface_version=4.3.DotNet8_0.received.txt //---------------------- // <auto-generated> // Generated using the NSwag toolchain v11.0.0.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // </auto-generated> //---------------------- export interface Person { FirstName: string | undefined; LastName: string | undefined; } export interface Student extends Person { Study: string | undefined; } export interface MyClass { Name: string | undefined; DateOfBirth: Date; PrimitiveArray: number[] | undefined; PrimitiveDictionary: { [key: string]: number; } | undefined; DateArray: Date[] | undefined; DateDictionary: { [key: string]: Date; } | undefined; Reference: Student | undefined; Array: Student[] | undefined; Dictionary: { [key: string]: Student; } | undefined; }
windows-latest
[xUnit.net 00:00:00.84] NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: KnockoutClass, version: 4.3) [FAIL]
windows-latest
[xUnit.net 00:00:00.86] NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: Interface, version: 1.8) [FAIL]
windows-latest
[xUnit.net 00:00:00.87] NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: KnockoutClass, version: 2.7) [FAIL]
windows-latest
[xUnit.net 00:00:00.88] NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: Class, version: 1.8) [FAIL]
windows-latest
[xUnit.net 00:00:00.89] NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: Interface, version: 4.3) [FAIL]
NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: KnockoutClass
VerifyException : Directory: D:\a\NJsonSchema\NJsonSchema\src\NJsonSchema.CodeGeneration.TypeScript.Tests New: - Received: ClassGenerationTests.Verify_output_style=KnockoutClass_version=4.3.DotNet8_0.received.txt Verified: ClassGenerationTests.Verify_output_style=KnockoutClass_version=4.3.verified.txt FileContent: New: Received: ClassGenerationTests.Verify_output_style=KnockoutClass_version=4.3.DotNet8_0.received.txt //---------------------- // <auto-generated> // Generated using the NSwag toolchain v11.0.0.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // </auto-generated> //---------------------- export class Person { firstName = ko.observable<string | undefined>(); lastName = ko.observable<string | undefined>(); init(data?: any) { if (data !== undefined) { var firstName_: any; firstName_ = _data["FirstName"]; this.firstName(firstName_); var lastName_: any; lastName_ = _data["LastName"]; this.lastName(lastName_); } } static fromJS(data: any): Person { let result = new Person(); result.init(data); return result; } toJSON(data?: any) { data = typeof data === 'object' ? data : {}; let firstName_: any = this.firstName(); data["FirstName"] = firstName_; let lastName_: any = this.lastName(); data["LastName"] = lastName_; return data; } } export class Student extends Person { study = ko.observable<string | undefined>(); override init(data?: any) { super.init(data); if (data !== undefined) { var study_: any; study_ = _data["Study"]; this.study(study_); } } static override fromJS(data: any): Student { let result = new Student(); result.init(data); return result; } override toJSON(data?: any) { data = typeof data === 'object' ? data : {}; let study_: any = this.study(); data["Study"] = study_; super.toJSON(data); return data; } } export class MyClass { name = ko.observable<string | undefined>("foo"); dateOfBirth = ko.observable<Date>(); primitiveArray = ko.observableArray<number>(); primitiveDictionary = ko.observable<{ [key: string]: number; } | undefined>(); dateArray = ko.observableArray<Date>(); dateDictionary = ko.observable<{ [key: string]: Date; } | undefined>(); reference = ko.observable<Student | undefined>(); array = ko.observableArray<Student>(); dictionary = ko.observable<{ [key: string]: Student; } | undefined>(); init(data?: any) { if (data !== undefined) { var name_: any; name_ = _data["Name"] !== undefined ? _data["Name"] : "foo"; this.name(name_); var dateOfBirth_: any; dateOfBirth_ = _data["DateOfBirth"] ? new Date(_data["DateOfBirth"].toString()) : <any>undefined; this.dateOfBirth(dateOfBirth_); var primitiveArray_: any; if (Array.isArray(_data["PrimitiveArray"])) { primitiveArray_ = [] as any; for (let item of _data["PrimitiveArray"]) primitiveArray_!.push(item); } this.primitiveArray(primitiveArray_); var primitiveDictionary_: any; if (_data["PrimitiveDictionary"]) { primitiveDictionary_ = {} as any; for (let key in _data["PrimitiveDictionary"]) { if (_data["PrimitiveDictionary"].hasOwnProperty(key)) (<any>primitiveDictionary_)![key] = _data["PrimitiveDictionary"][key]; } } this.primitiveDictionary(primitiveDictionary_); var dateArray_: any; if (Array.isArray(_data["DateArray"])) { dateArray_ = [] as any; for (let item of _data["DateArray"]) dateArray_!.push(new Date(item
NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: Interface
VerifyException : Directory: D:\a\NJsonSchema\NJsonSchema\src\NJsonSchema.CodeGeneration.TypeScript.Tests New: - Received: ClassGenerationTests.Verify_output_style=Interface_version=1.8.DotNet8_0.received.txt Verified: ClassGenerationTests.Verify_output_style=Interface_version=1.8.verified.txt FileContent: New: Received: ClassGenerationTests.Verify_output_style=Interface_version=1.8.DotNet8_0.received.txt //---------------------- // <auto-generated> // Generated using the NSwag toolchain v11.0.0.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // </auto-generated> //---------------------- export interface Person { FirstName: string; LastName: string; } export interface Student extends Person { Study: string; } export interface MyClass { Name: string; DateOfBirth: Date; PrimitiveArray: number[]; PrimitiveDictionary: { [key: string]: number; }; DateArray: Date[]; DateDictionary: { [key: string]: Date; }; Reference: Student; Array: Student[]; Dictionary: { [key: string]: Student; }; }
NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: KnockoutClass
VerifyException : Directory: D:\a\NJsonSchema\NJsonSchema\src\NJsonSchema.CodeGeneration.TypeScript.Tests New: - Received: ClassGenerationTests.Verify_output_style=KnockoutClass_version=2.7.DotNet8_0.received.txt Verified: ClassGenerationTests.Verify_output_style=KnockoutClass_version=2.7.verified.txt FileContent: New: Received: ClassGenerationTests.Verify_output_style=KnockoutClass_version=2.7.DotNet8_0.received.txt //---------------------- // <auto-generated> // Generated using the NSwag toolchain v11.0.0.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // </auto-generated> //---------------------- export class Person { firstName = ko.observable<string | undefined>(); lastName = ko.observable<string | undefined>(); init(data?: any) { if (data !== undefined) { var firstName_: any; firstName_ = _data["FirstName"]; this.firstName(firstName_); var lastName_: any; lastName_ = _data["LastName"]; this.lastName(lastName_); } } static fromJS(data: any): Person { let result = new Person(); result.init(data); return result; } toJSON(data?: any) { data = typeof data === 'object' ? data : {}; let firstName_: any = this.firstName(); data["FirstName"] = firstName_; let lastName_: any = this.lastName(); data["LastName"] = lastName_; return data; } } export class Student extends Person { study = ko.observable<string | undefined>(); init(data?: any) { super.init(data); if (data !== undefined) { var study_: any; study_ = _data["Study"]; this.study(study_); } } static fromJS(data: any): Student { let result = new Student(); result.init(data); return result; } toJSON(data?: any) { data = typeof data === 'object' ? data : {}; let study_: any = this.study(); data["Study"] = study_; super.toJSON(data); return data; } } export class MyClass { name = ko.observable<string | undefined>("foo"); dateOfBirth = ko.observable<Date>(); primitiveArray = ko.observableArray<number>(); primitiveDictionary = ko.observable<{ [key: string]: number; } | undefined>(); dateArray = ko.observableArray<Date>(); dateDictionary = ko.observable<{ [key: string]: Date; } | undefined>(); reference = ko.observable<Student | undefined>(); array = ko.observableArray<Student>(); dictionary = ko.observable<{ [key: string]: Student; } | undefined>(); init(data?: any) { if (data !== undefined) { var name_: any; name_ = _data["Name"] !== undefined ? _data["Name"] : "foo"; this.name(name_); var dateOfBirth_: any; dateOfBirth_ = _data["DateOfBirth"] ? new Date(_data["DateOfBirth"].toString()) : <any>undefined; this.dateOfBirth(dateOfBirth_); var primitiveArray_: any; if (Array.isArray(_data["PrimitiveArray"])) { primitiveArray_ = [] as any; for (let item of _data["PrimitiveArray"]) primitiveArray_!.push(item); } this.primitiveArray(primitiveArray_); var primitiveDictionary_: any; if (_data["PrimitiveDictionary"]) { primitiveDictionary_ = {} as any; for (let key in _data["PrimitiveDictionary"]) { if (_data["PrimitiveDictionary"].hasOwnProperty(key)) (<any>primitiveDictionary_)![key] = _data["PrimitiveDictionary"][key]; } } this.primitiveDictionary(primitiveDictionary_); var dateArray_: any; if (Array.isArray(_data["DateArray"])) { dateArray_ = [] as any; for (let item of _data["DateArray"]) dateArray_!.push(new Date(item)); }
NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: Class
VerifyException : Directory: D:\a\NJsonSchema\NJsonSchema\src\NJsonSchema.CodeGeneration.TypeScript.Tests New: - Received: ClassGenerationTests.Verify_output_style=Class_version=1.8.DotNet8_0.received.txt Verified: ClassGenerationTests.Verify_output_style=Class_version=1.8.verified.txt FileContent: New: Received: ClassGenerationTests.Verify_output_style=Class_version=1.8.DotNet8_0.received.txt //---------------------- // <auto-generated> // Generated using the NSwag toolchain v11.0.0.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // </auto-generated> //---------------------- export class Person implements IPerson { firstName: string; lastName: string; constructor(data?: IPerson) { if (data) { for (var property in data) { if (data.hasOwnProperty(property)) (<any>this)[property] = (<any>data)[property]; } } } init(_data?: any) { if (_data) { this.firstName = _data["FirstName"]; this.lastName = _data["LastName"]; } } static fromJS(data: any): Person { data = typeof data === 'object' ? data : {}; let result = new Person(); result.init(data); return result; } toJSON(data?: any) { data = typeof data === 'object' ? data : {}; data["FirstName"] = this.firstName; data["LastName"] = this.lastName; return data; } } export interface IPerson { firstName: string; lastName: string; } export class Student extends Person implements IStudent { study: string; constructor(data?: IStudent) { super(data); } init(_data?: any) { super.init(_data); if (_data) { this.study = _data["Study"]; } } static fromJS(data: any): Student { data = typeof data === 'object' ? data : {}; let result = new Student(); result.init(data); return result; } toJSON(data?: any) { data = typeof data === 'object' ? data : {}; data["Study"] = this.study; super.toJSON(data); return data; } } export interface IStudent extends IPerson { study: string; } export class MyClass implements IMyClass { name: string; dateOfBirth: Date; primitiveArray: number[]; primitiveDictionary: { [key: string]: number; }; dateArray: Date[]; dateDictionary: { [key: string]: Date; }; reference: Student; array: Student[]; dictionary: { [key: string]: Student; }; constructor(data?: IMyClass) { if (data) { for (var property in data) { if (data.hasOwnProperty(property)) (<any>this)[property] = (<any>data)[property]; } } if (!data) { this.name = "foo"; } } init(_data?: any) { if (_data) { this.name = _data["Name"] !== undefined ? _data["Name"] : "foo"; this.dateOfBirth = _data["DateOfBirth"] ? new Date(_data["DateOfBirth"].toString()) : <any>undefined; if (Array.isArray(_data["PrimitiveArray"])) { this.primitiveArray = [] as any; for (let item of _data["PrimitiveArray"]) this.primitiveArray.push(item); } if (_data["PrimitiveDictionary"]) { this.primitiveDictionary = {} as any; for (let key in _data["PrimitiveDictionary"]) { if (_data["PrimitiveDictionary"].hasOwnProperty(key)) (<any>this.primitiveDictionary)[key] = _data["PrimitiveDictionary"][key]; } } if (Array.isArray(_data["DateArray"])) { this.dateArray = [] as any; for (let item of _data["DateArray"]) this.dateArray.push(new Date(item)); } if (_data["DateDictionary"]) { this.dateDictionary = {} as any; for (let key in _data["DateDictionary"]) {
windows-latest
[xUnit.net 00:00:00.90] NJsonSchema.CodeGeneration.TypeScript.Tests.ClassGenerationTests.Verify_output(style: Interface, version: 2.1) [FAIL]