You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on a Express.js backend and using TypeORM for DB operations. As in TypeORM we Entity classes for DB tables, I used the same classes for (de)serialization purpose too. I am using serializr for this. For example:
import{Column,Entity,ManyToOne,OneToMany,PrimaryGeneratedColumn}from"typeorm";// The User class is a TypeORM entity as well as be used for (de)serialization
@Entity({name: "users"})classUser{
@serializable
@PrimaryGeneratedColumn()id: number;
@serializable
@Column({nullable: false})name: string;}
But the issue occurs when I have something like following:
I am working on a Express.js backend and using TypeORM for DB operations. As in TypeORM we Entity classes for DB tables, I used the same classes for (de)serialization purpose too. I am using serializr for this. For example:
But the issue occurs when I have something like following:
This creates a circular dependency and getting the following error from serializr:
I found about identifier() and reference() in serializr documentation and tried is as following:
But still getting the same error. Please suggest me any fix for this.
The text was updated successfully, but these errors were encountered: