Когда я обновил библиотеку @ nest / swagger до версии 4, произошла эта ошибка:
(node:16134) UnhandledPromiseRejectionWarning: Error: A circular dependency has been detected (property key: "customer"). Please, make sure that each side of a bidirectional relationships are using lazy resolvers ("type: () => ClassType").
at SchemaObjectFactory.createNotBuiltInTypeReference (/opt/desenvolvimento/Haizen/projectx_back/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:182:19)
at SchemaObjectFactory.mergePropertyWithMetadata (/opt/desenvolvimento/Haizen/projectx_back/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:117:25)
at /opt/desenvolvimento/Haizen/projectx_back/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:66:35
at Array.map (<anonymous>)
at SchemaObjectFactory.exploreModelSchema (/opt/desenvolvimento/Haizen/projectx_back/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:65:52)
at SchemaObjectFactory.createNotBuiltInTypeReference (/opt/desenvolvimento/Haizen/projectx_back/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:187:37)
at SchemaObjectFactory.mergePropertyWithMetadata (/opt/desenvolvimento/Haizen/projectx_back/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:117:25)
at /opt/desenvolvimento/Haizen/projectx_back/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:66:35
at Array.map (<anonymous>)
at SchemaObjectFactory.exploreModelSchema (/opt/desenvolvimento/Haizen/projectx_back/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:65:52)
Класс моей модели выглядит так:
@Entity()
export class Job {
.
.
.
@ManyToOne(type => Customer, customer => customer.jobs)
@ApiProperty({ type: Customer })
customer: Customer;
}