bee icon indicating copy to clipboard operation
bee copied to clipboard

OpenAPI circular reference definition

Open tmm360 opened this issue 3 years ago • 0 comments

Context

There is an issue of circular dependency into open api definition that doesn't permit to resolve all references.

Summary

In SwarmCommon.yaml there are definitions of LoggerTreeData and LoggerTreeNode with circular dependencies:

    LoggerTreeData:
      type: object
      nullable: true
      properties:
        /:
          $ref: "#/components/schemas/LoggerTreeNode"
        +:
          type: array
          items:
            type: string
          description: The combination of the logger verbosity and its subsystem separated by |.
          example: "warning|one/name[0][]>>824634860360"

    LoggerTreeNode:
      type: object
      additionalProperties:
          $ref: "#/components/schemas/LoggerTreeData"

This should be avoided, because doesn't permit to resolve all references with tools like speccy (https://github.com/wework/speccy).

Expected behavior

OpenAPI definition shouldn't contain circular dependencies.

Actual behavior

Execution of speccy tool on current open api definition gives Maximum call stack size exceeded error.

Possible solution

Verify if circular dependency is really required, and try to avoid it if possible.

tmm360 avatar Oct 17 '22 17:10 tmm360