Circular Dependency with Nestjs Swagger 4

The solution that worked for me was to declare in @ApiProperty() the type with arrow function, like below:

@Entity()
export class Job {
.
.
.
    @ManyToOne(type => Customer, customer => customer.jobs)
    @ApiProperty({ type: () => Customer })
    customer: Customer;
}

Leave a Comment