Skip to content

Detect cyclic dependencies in property definitions #1799

@bajtos

Description

@bajtos

While working on belongsTo relation in #1618, we discovered a need to detect circular dependencies in property definitions and provide a helpful error to users.

Here is a PoC code that did not make it to master yet:

https://github.com/strongloop/loopback-next/blob/bcd7ee98cc4958ccde595cf26e35e6f53f236401/packages/repository/src/decorators/model.decorator.ts#L90-L110

We should take a closer look at different ways how a cyclic relation can be introduced, write tests to reproduce those cases and then fix the implementation to throw an error that explains the user what went wrong and how to fix the problem.

Acceptance criteria

TBD

Metadata

Metadata

Assignees

No one assigned

    Labels

    RelationsModel relations (has many, etc.)RepositoryIssues related to @loopback/repository packagefeaturestale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions