no-cyclic-dependency-in-type-declaration
Overview
This rule belongs to the raml-validation ruleset and states that:
In RAML, custom types can be defined by extending the built-in or named types and then used like built-in types. Extending types must not create any cyclic dependencies.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Error |
| Message | Cyclic dependency found in the type declaration. |
| Code | RAML_V205 |
| Type | Validation |
| Rule System | Semantic |
| Broad Category | Types |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | raml semantic validation type declaration type cyclic |
Suggested Fixes
- Ensure that a type does not eventually depend on itself while extending types.
- Identify the cyclic chain and break the loop e.g. if your type is A it may be possible that the dependency chain looks something like A -> B -> C -> A. In such cases the C -> A creates a cycle and needs to be modified so that the chain does not involve A itself again.
For More Information
- https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md#introduction-1:~:text=Extending%20types%20MUST%20NOT%20create%20any%20cyclic%20dependencies.
- https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md#type-declarations
- https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md
- https://github.com/raml-org/raml-spec/blob/master/versions/raml-08/raml-08.md
- https://docs.apimatic.io/rulesets/overview/