Layer7 API Management

 View Only
  • 1.  Problem Swagger with Circular Reference

    Posted Jan 10, 2020 08:12 AM
    When I make a cyclic reference in swagger, and try to open the documentation in the developer menu, an error occurs on the page. In the browser console I see the following:

    Uncaught (in promise) RangeError: Maximum call stack size exceeded
    at vendor_bcf6c535bcee95c12bb0.js:1
    at r (vendor_bcf6c535bcee95c12bb0.js:1)
    at n (main_ab5e630d3b1e9decbecb.js:1)
    at i (main_ab5e630d3b1e9decbecb.js:1)
    at i (main_ab5e630d3b1e9decbecb.js:1)
    at main_ab5e630d3b1e9decbecb.js:1
    at main_ab5e630d3b1e9decbecb.js:1
    at vendor_bcf6c535bcee95c12bb0.js:1
    at r (vendor_bcf6c535bcee95c12bb0.js:1)
    at n (main_ab5e630d3b1e9decbecb.js:1)


    the piece of swagger with problem is this, where there is the cyclic reference:

        "Message": {
          "properties": {
            "code": {
              "type": "string"
            },
            "detail": {
              "type": "string"
            },
            "relatedMessage": {
              "items": {
                "$ref": "#/definitions/Message"
              },
              "type": "array"
            },
            "title": {
              "type": "string"
            },
            "type": {
              "enum": [
                "INFO",
                "WARNING",
                "ERROR"
              ],
              "type": "string"
            }
          },
          "type": "object"
        }

    Installed Version: 4.2.9.3
    I searched changelog and found no known bugs with this problem.



    Removing the reference "$ref": "#/definitions/Message" opens normally.


  • 2.  RE: Problem Swagger with Circular Reference
    Best Answer

    Broadcom Employee
    Posted Jan 10, 2020 02:42 PM
    I suspect this might be fixed in a newer release sinc 4.2.9 is pretty aged. I suspect its the JSON support under the covers that isnt formatting this properly as I have seen fixes around that. Any plans to migrate to a more current version?


  • 3.  RE: Problem Swagger with Circular Reference

    Posted Jan 13, 2020 03:12 AM
    I looked through the change logs and found no bug fixes about this issue. For now there is no prevision to update.