Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Circular reference is considered an error

See original GitHub issue

Issue Description

When you have a yaml model that reference itself, the validate function consider it an error, which is not. It is completely supported by tools like swagger-editor and swagger-codegen.

I’m using the latest release on npm (1.0.1).

To reproduce, use the petstore and add this in the definition part:

  type: string
  description: "List of all menu item descriptions"
    - Choice1
    - Choice2
    - Choice3
  type: object
  description: "Item in a menu"
    - description
    - childMenuItems
      $ref: "#/definitions/MenuItemDescription"
      type: array
        $ref: "#/definitions/MenuItem"

The error is as follow:

Swagger schema validation failed.
  Expected type object but found type string at #/definitions/$ref



Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

eugene-rockspooncommented, Jan 5, 2021

It seems there isn’t solution but better error description, at least for swagger-cli bundle -r:

Circular $ref pointer found at /Users/name/go/src/

where elements/items:

        $ref: "./myModel.yaml"
      type: array
      x-go-name: Elements

and swagger-cli validate gives swagger.yaml is valid

msandasynteacommented, Dec 14, 2022

Hello, I have found this thread today when I was searching for exactly this problem. I am getting exactly the same results as @eugene-rockspoon metioned. Funny fact I can validate my openApi.yaml spec locally (without error), but we are using it in gitlab CI and it fails. The version of swagger-cli is exactly the same in both enviroments (4.0.4). So this problem is still actual and I think it has to be resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove or allow a circular reference - Microsoft Support
If you can't find the error, click the Formulas tab, click the arrow next to Error Checking, point to Circular References, and then...
Read more >
How to fix a circular reference error - Excel formula - Exceljet
Circular reference errors occur when a formula refers back to its own cell. For example, in the example shown, the formula in F7...
Read more >
How To Find and Remove Circular References in Excel - Indeed
One of the most common reasons a circular reference occurs is by mistake. For instance, consider someone who wants to calculate the sum...
Read more >
What is a circular reference in Excel // PerfectXL ... - PerfectXL
A circular reference refers to a formula, that visits its own or another cell more than once in its chain of calculations, creating...
Read more >
What Is Circular Reference in Excel? Everything You Need to ...
Circular reference is a type of error in Excel that occurs when a formula in a cell tries to calculate itself. Find out...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found