question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:6
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
hnthucommented, 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

3reactions
blignycommented, Oct 9, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

undefined Not Found" messages in Swagger UI 3 - Stack ...
The resolver sometimes chokes on deeply nested schemas, long allOf + $ref chains, and/or circular references. Here are similar issues in Swagger ...
Read more >
Swagger $ref gives "Could not resolve reference: u...
Swagger $ref gives "Could not resolve reference: undefined undefined" so I'm trying to separate the objects that we give in the responses body ......
Read more >
Using $ref - Swagger
$ref Syntax​​ If the string value does not conform URI syntax rules, it causes an error during the resolving. Any members other than...
Read more >
Circular reference is not allowed
Make sure that you have not defined any circular references for the schemas in your API. Copyright 2019—2022 42Crunch Ltd — All Rights...
Read more >
Looker error catalog | Google Cloud
Validate once more to resolve the error. create_process parameter reference. Can't construct aggregate table (?), temporary schema for (?) is unset.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found