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

Circular reference in schema leads to Could not resolve reference: undefined undefined #5726

Open
TimoKunze opened this issue Nov 24, 2019 · 10 comments

Comments

@TimoKunze
Copy link

Q&A (please complete the following information)

  • OS: Alpine Linux
  • Browser: Vivaldi
  • Version: 2.9
  • Method of installation: docker
  • Swagger-UI version: actually unknown, should be latest
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

Example Swagger/OpenAPI definition:

openapi: "3.0.0"
info:
  title: "Test API For Self Reference"
  version: "1.0"


paths:
  /greeting:
    get:
      tags:
        - Client
      description: 'Get the current client session identifier.'
      responses:
        200: 
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Person'
        
components:
  schemas:
    Person:
      type: object
      required:
        - name
        - age
      properties:
        name:
         type: string
         example: 'John Doe'
        age:
          type: integer
          example: 42
        parent:
          $ref: '#/components/schemas/Person'
        brother:
          $ref: '#/components/schemas/Person'

Swagger-UI configuration options:
Where do I find it?

Describe the bug you're encountering

When expanding the Person schema, Swagger-UI displays this error on top of the page:
Resolver error at components.schemas.Person.properties.parent.$ref
Could not resolve reference: undefined undefined

To reproduce...

Steps to reproduce the behavior:

  1. Scroll down to 'schemas'
  2. Click on 'Person' to expand it
  3. Scroll up to the top of the page
  4. See error

Expected behavior

No error should occur.

@TimoKunze
Copy link
Author

Hmm, I kind of fixed it by entering the absolute path (instead of relative one) to the yaml file in the Explore text field. I'm not sure whether this is the way it is meant to be...

@webron
Copy link
Contributor

webron commented Nov 25, 2019

Are you sure you're using the latest version? Can't seem to reproduce it on editor.swagger.io.

@hnthu
Copy link

hnthu commented May 11, 2020

I have met the same issue for using 3.25.2.
I have a quick check and figure out the issue happened from 3.22.3
Have check on editor.swagger.io

it's empty instead of throwing a warning on the top of the page.

image

@bligny
Copy link

bligny commented Oct 9, 2020

The issue is still there (5 months later).
Any fix foreseen ?

@cgockeln42
Copy link

Is here any work done so far? Highly interested in a fix

@meredrica
Copy link

we have the same issue. any help?

valorekhov pushed a commit to AICPA-ADS/AuditData-API that referenced this issue Jun 10, 2021
@Messhias
Copy link

Messhias commented Aug 6, 2021

2 years passed, no one will look at it anymore.

@meredrica
Copy link

Yep @Messhias we are already looking alternatives. Rapi docs looks promising

@Messhias
Copy link

Messhias commented Aug 6, 2021

Yep @Messhias we are already looking alternatives. Rapi docs looks promising

Hi @meredrica can you shade the link of it?

Thanks,

@wangdashuaihenshuai
Copy link

why swagger ui support circle referrece so diffcult.

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

8 participants