fix for resolving looping relative references

In vacuum, a usecase was reported where an infinite loop occurred due to re-parsing the same reference over and over in a loop. It was re-creatable and it was because the loop happened before the index was ready.

This should be resolved now, at least for this use case. To be sure, I have included the specs as a new test.

https://github.com/daveshanley/vacuum/issues/268
Signed-off-by: Dave Shanley <dave@quobix.com>
This commit is contained in:
Dave Shanley
2023-05-16 16:12:32 -04:00
parent 08c9ca8c26
commit f629c0ff58
13 changed files with 1383 additions and 1268 deletions

33
test_specs/first.yaml Normal file
View File

@@ -0,0 +1,33 @@
openapi: 3.0.0
info:
title: title
description: description
version: 0.0.0
paths:
/items:
get:
tags:
- items
summary: summary
description: description
parameters: []
responses:
'200':
description: OK
content:
application/json:
schema:
title: Schema
description: description
type: object
additionalProperties:
type: object
title: first title
description: first description
additionalProperties: false
properties:
second:
$ref: "second.yaml"

31
test_specs/second.yaml Normal file
View File

@@ -0,0 +1,31 @@
title: second doc title
description: second doc description
type: object
additionalProperties: false
properties:
property1:
title: title
description: property 1 description
type: array
items:
title: item
description: third description
type: object
additionalProperties: false
properties:
details:
$ref: "third.yaml"
property2:
title: title
description: property 2 description
type: object
additionalProperties: false
properties:
property:
title: title
description: tasty description
type: integer

15
test_specs/third.yaml Normal file
View File

@@ -0,0 +1,15 @@
title: third doc title
description: third doc description
type: object
additionalProperties: false
maxProperties: 1
properties:
property:
title: title of third prop in third doc
type: object
properties:
statistics:
$ref: 'second.yaml#/properties/property2'