vs-openapi-designer
vs-openapi-designer copied to clipboard
Unstable after circular reference
Unstable (i.e. wont pick up new files or preview new files) after a YAML OAS 3 with external references, where in one of those external references, has a anyOf: array with two options: string or a reference back to self. Uninstalling and re-installing does not help.
Example:
openapi.yaml
---
openapi: 3.0.0
# etc
components:
schemas:
StuffDefinition:
$ref: 'stuff.yaml#/schemas/Stuff
stuff.yaml
schemas:
Stuff:
type: object
properties:
mistake:
type: array
items:
anyOf:
- type: string
description: supposed to be a composite reference of to an existing object
- $ref: '#/schemas/Stuff'
description: supposed to be an inline subordinate object
I think my problem is the same as @avelinob 's, so I will describe it here instead of creating a new issue.
Here is my schema definition.
Foo:
type: object
properties:
name:
type: string
sub-foos:
type: array
items:
type: object
If I select OpenAPI Designer > Preview in side panel, it works fine.
If I reference foo as the type of sub-foos, which is legal in OAS, I get an error in the preview and it loads the default Pet Store example. Also, the auto-complete does not list Foo when trying to $ref it inside of itself.
Foo:
type: object
properties:
name:
type: string
sub-foos:
type: array
items:
$ref: '#/components/schemas/Foo'
Here is what I get then:

If anyone has any bandwidth can you validate this type of circular reference works in the official https://editor.swagger.io/? Primarily, this extension just wraps the official editor so its helpful to know how the official editor behaves given a circular reference.