Skip to main content

no-model-circular-dependency

Overview

This rule belongs to the apimatic-preliminary-linting ruleset and states that:

A model containing one or more required fields (whether inherited or not) which reference the same model either directly or indirectly indicates presence of a circular dependency. Referencing a model (say A) indirectly means the field(s) references another model (say B) which may contain one or more fields that directly or indirectly reference the model under consideration (A).

PropertyValue
EnabledYes
Maximum SeverityWarning
MessageCircular dependency detected in model.
CodeAPIMATICPRE_L102
TypeLinting
Rule SystemSemantic
Broad CategoryTypes/Models
Products ImpactedCode Generation, Developer Experience Portal, API Transformer
Tagspreliminary checks linting apimatic circular dependency field property type custom type model complex model

Suggested Fixes

  • A dependency chain like A -> B indicates that one or more fields of model A reference a model B which contains one or more fields that reference back to model A.
  • Model indicated at the end of the dependency chain contains one or more fields that reference the model which is under consideration.
  • Models containing circular dependencies via required fields is not recommended and may cause issues.

For More Information