Circular reference detected

Issue ID: v3_1-warning-reference-circular

Description

Description

One or more schemas in your API have a circular reference. While this is allowed, it might not be what you want.

Circular references can occur in API definitions, especially when using polymorphism and combining operations allOf, oneOf, anyOf, and not properties. Circular references are not inherently wrong, and there may even be legitimate use cases for them.

However, circular references can become a problem when combined with the property required. Circular reference could mean that a schema cannot resolve all or some of its properties. If the schema in question has been marked as required, this creates an infinite loop.

In 42Crunch API Security Platform, although the infinite looping is handled, circular references can still cause problems when trying to generate a scan configuration for running API Scan: the looping behavior can increase the size of the payload so that it exceeds the maximum allowed limits and creating the scan configuration fails.

Circular references on the same level are not allowed. For example, a schema object in allOf must not reference the schema holding the allOf property. Same applies to oneOf, anyOf, and not properties.

For more details, see the OpenAPI Specification.

Remediation

Make sure that you have not defined any circular references for schemas that have been marked as required, or circular references on the same level. We recommend carefully considering if the circular reference is the best option to achieve the desired outcome in your API.