Skip to content

Model with recursive items cause RecursionError #122

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

Closed
danielbradburn opened this issue Mar 19, 2019 · 1 comment
Closed

Model with recursive items cause RecursionError #122

danielbradburn opened this issue Mar 19, 2019 · 1 comment
Labels
area/schema Indicates an issue on schema area kind/bug/confirmed

Comments

@danielbradburn
Copy link
Contributor

The SchemaRegistry doesn't handle recursive references, for example the following schema crashes with a RecursionError: maximum recursion depth exceeded while calling a Python object while trying to parse...

    Tree:
      properties:
        children:
          type: array
          items: 
            $ref: '#/components/schemas/Tree'

It looks like support was added to handle recursive properties, but recursive array items is currently not supported.

@phrfpeixoto
Copy link
Contributor

phrfpeixoto commented Jul 4, 2019

I've just hit this road block with simple users/groups models:

schemas:
  Group:
    type: object
    required:
      - id
      - users
    properties:
      id:
        type: string
        format: uuid
        readOnly: true
      users:
        type: array
        items:
          $ref: '#/components/schemas/User'
  User:
    type: object
    required:
      - id
      - groups
    properties:
      id:
        type: string
        format: uuid
        readOnly: true
      groups:
        type: array
        items:
          $ref: '#/components/schemas/Group'

I quickly checked the code and it seems that references are not held. Instead the code dereferences every single $ref and replaces it with an instance of Schema, so I did not see any practical way of fixing this.

On this case it was easier to work around, by removing the property on one of the models.

@p1c2u p1c2u added the area/schema Indicates an issue on schema area label Sep 5, 2019
@p1c2u p1c2u closed this as completed Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/schema Indicates an issue on schema area kind/bug/confirmed
Projects
None yet
Development

No branches or pull requests

3 participants