Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unstable after circular reference #27

Open
avelinob opened this issue Feb 20, 2019 · 2 comments
Open

Unstable after circular reference #27

avelinob opened this issue Feb 20, 2019 · 2 comments

Comments

@avelinob
Copy link

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
@Adeynack
Copy link

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:

image

@philosowaffle
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants