Skip to content

Recursive reference #347

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
Kludex opened this issue Mar 12, 2021 · 1 comment
Closed

Recursive reference #347

Kludex opened this issue Mar 12, 2021 · 1 comment
Labels
🐞bug Something isn't working

Comments

@Kludex
Copy link

Kludex commented Mar 12, 2021

Describe the bug

So... I have this:

class FolderChildren(BaseModel):
    """
    Folder schema to output from GET folders/{folder_id}/children method.
    """

    id: int
    name: str
    n_docs: int
    children: Optional[List["FolderChildren"]] = None

FolderChildren.update_forward_refs()

And the error is:

Warning(s) encountered while generating. Client was generated, but some pieces may be missing

WARNING parsing GET /api/v1/folders/{folder_id}/children/ within hierarchy.

Cannot parse response for status code 200, response will be ommitted from generated client

Reference(ref='#/components/schemas/FolderChildren')

Unable to parse this part of your OpenAPI document: 

invalid data in items of array children

Reference(ref='#/components/schemas/FolderChildren')

I believe the problem is the self-reference. Am I wrong?

Expected behavior
Not having the error message.

OpenAPI Spec File
Can't give you this.

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Python Version: 3.6.9
  • openapi-python-client version 0.8.0
@Kludex Kludex added the 🐞bug Something isn't working label Mar 12, 2021
@emann
Copy link
Collaborator

emann commented Mar 12, 2021

Unfortunately recursively defined schemas aren't supported currently. There's a pull request (#329) to add support but we need to take another look at it. There's already a ticket for this (#338) so I'll close this for now - if this is still giving you issues once support is added feel free to reopen.

@emann emann closed this as completed Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants