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

incorrect "ValueError: $ref circular references found!" in parser #57

Closed
ubyjvovk opened this issue Feb 12, 2016 · 3 comments
Closed

incorrect "ValueError: $ref circular references found!" in parser #57

ubyjvovk opened this issue Feb 12, 2016 · 3 comments

Comments

@ubyjvovk
Copy link

Given two files,

testing.yml

swagger: '2.0'
info:
  version: "0.1.1"
  title: test Application

paths:
  /account:
    get:
      responses:
        '200':
          description: the status of an account
          schema:
            properties:
              account:
                $ref: '#/definitions/Account'

definitions:
  $ref: 'testdef.yml'

and testdef.yml:

Account:
  type: object
  required:
    - emailAddress
  properties:
    emailAddress:
      type: string
    installationInformation:
      $ref: '#/InstallationInformation'


InstallationInformation:
  description: A collection of information that describes an instance of the application and what device it is running on.
  properties:
    OSType:
      type: string
      description:
        Android or Apple or other

They validate ok:

schemas$ swagger validate testing.yml 
testing.yml is valid

but swagger_py_codegen stumbles on $refs:

$ swagger_py_codegen  --swagger-doc schemas/testing.yml -p api app --ui --spec
Traceback (most recent call last):
  File "/home/d/venv/tm/bin/swagger_py_codegen", line 11, in <module>
    sys.exit(generate())
  File "/home/d/venv/tm/local/lib/python2.7/site-packages/click/core.py", line 700, in __call__
    return self.main(*args, **kwargs)
  File "/home/d/venv/tm/local/lib/python2.7/site-packages/click/core.py", line 680, in main
    rv = self.invoke(ctx)
  File "/home/d/venv/tm/local/lib/python2.7/site-packages/click/core.py", line 873, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/d/venv/tm/local/lib/python2.7/site-packages/click/core.py", line 508, in invoke
    return callback(*args, **kwargs)
  File "/home/d/venv/tm/local/lib/python2.7/site-packages/swagger_py_codegen/command.py", line 77, in generate
    swagger = Swagger(data)
  File "/home/d/venv/tm/local/lib/python2.7/site-packages/swagger_py_codegen/parser.py", line 29, in __init__
    self._references_sort()
  File "/home/d/venv/tm/local/lib/python2.7/site-packages/swagger_py_codegen/parser.py", line 67, in _references_sort
    raise ValueError(msg)
ValueError: $ref circular references found!

@ciacicode
Copy link

Got the same problem here. Is there a way I can get past this while it's getting fixed?

@RakiP
Copy link

RakiP commented Mar 23, 2018

this problem still persists

gusibi added a commit that referenced this issue Mar 29, 2018
gusibi added a commit that referenced this issue Mar 29, 2018
@gusibi
Copy link
Member

gusibi commented Mar 29, 2018

@debdude
this problem fixed

but need to modify the testdef.yml file

$ref: '#/InstallationInformation' ->  $ref: '#/definitions/InstallationInformation'

@gusibi gusibi closed this as completed Aug 21, 2018
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

4 participants