Circular reference is considered an error
See original GitHub issueWhen 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:
MenuItemDescription:
type: string
description: "List of all menu item descriptions"
enum:
- Choice1
- Choice2
- Choice3
MenuItem:
type: object
description: "Item in a menu"
required:
- description
- childMenuItems
properties:
description:
$ref: "#/definitions/MenuItemDescription"
childMenuItems:
type: array
items:
$ref: "#/definitions/MenuItem"
The error is as follow:
Swagger schema validation failed.
Expected type object but found type string at #/definitions/$ref
JSON_OBJECT_VALIDATION_FAILED
Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:15 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It seems there isn’t solution but better error description, at least for
swagger-cli bundle -r
:where
elements/items
:and
swagger-cli validate
givesswagger.yaml is valid
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.