I have a structure of class
es in Typescript that are nested.
export class Vehicle {
id: string;
brand: string;
owner: Owner;
}
export class Owner {
id: string;
name: string;
}
I then have a CSV file from which I intend to load this structure.
id;brand;owner.id;owner.name
1;mazda;100;James
...
I'm having an issue with these nested values, since the id
and brand
are loaded correctly but the owner is not recognized by nest-csv-parser
.
The parsing:
const stream = fs.createReadStream('/path/to/file.csv');
const entities = await this.csvParser.parse(stream, Vehicle, undefined, undefined, { separator: ';'});
Please note that nest provides a CsvParser
module that is actually being imported.
Is there a way to successfully import this nested structure?
Thanks in advance.