You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Spectral falls into infinite loop when the supplied definition contain recursive model e.g. linked list with a file reference.
The same recursive model processes well with local references
To Reproduce
Given this OpenAPI/AsyncAPI document (save as "linked_list.yml")
linked_list.yml
openapi: 3.0.0servers:
- url: http://test.com/linked-listdescription: test servicetags:
- name: LinkedListdescription: Linked List operationsinfo:
title: Linked List DataObject Testversion: version.version0contact:
name: Kiril Karaatanassovdescription: test recursive data structurescomponents:
schemas:
Node:
description: 'Linked list node'example: {}properties:
label:
type: stringnext:
$ref: 'linked_list.yml#/components/schemas/Node'required:
- labeltype: objectpaths:
/test/linked-list:
get:
operationId: getLinkedListdescription: Returns a linked list that can be exception or trust chaintags: ["LinkedList"]responses:
'200':
description: Wow success!!!content:
"application/json":
schema:
$ref: '#/components/schemas/Node'
Run this CLI command './spectral lint linked_list.yml'
See error - spectral runs indefinitely, no output is produced
Expected behavior
validate the OpenAPI spec in finite time.
The same spec with removed file name from the recursive reference validates in couple of seconds
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (remove any that are not applicable):
Library version: 5.4.0
OS: Ubuntu 18.04
Additional notes
I found the following issue to be possibly related. In my case with 5.4.0 recursive types (i.e. circular reference) within the same file seem to work fine.
Again I do not see problems if the file name is removed form the schema. Problem is that to remove all filenames we have to flatten a relatively big API into single file (~8000 schemas and ~1000 operations)
The text was updated successfully, but these errors were encountered:
Describe the bug
Spectral falls into infinite loop when the supplied definition contain recursive model e.g. linked list with a file reference.
The same recursive model processes well with local references
To Reproduce
linked_list.yml
Expected behavior
validate the OpenAPI spec in finite time.
The same spec with removed file name from the recursive reference validates in couple of seconds
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (remove any that are not applicable):
Additional notes
I found the following issue to be possibly related. In my case with 5.4.0 recursive types (i.e. circular reference) within the same file seem to work fine.
#915
One of the comments mentions use of different library for handling JSON schema references
#1054
Again I do not see problems if the file name is removed form the schema. Problem is that to remove all filenames we have to flatten a relatively big API into single file (~8000 schemas and ~1000 operations)
The text was updated successfully, but these errors were encountered: