no-library-cyclic-dependency
Overview
This rule belongs to the raml-validation ruleset and states that:
A library fragment document can use uses property to reference external libraries if the assets defined in the current library require external assets as well. However, the uses property in a library fragment document must not be used to reference the library itself (whether directly or indirectly).
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Error |
| Message | Cyclic dependency found in the library. |
| Code | RAML_V803 |
| Type | Validation |
| Rule System | Semantic |
| Broad Category | Libraries |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | raml semantic validation cyclic library |
Suggested Fixes
- Ensure that the library does not eventually depend on itself when referencing external libraries using the
usesproperty. - Identify the cyclic chain and break the loop e.g. if your library 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#applying-libraries
- https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md#libraries
- 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/