Skip to content

Could not find reference in parsed models, when components title is different from the name #342

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
dongfangtianyu opened this issue Mar 1, 2021 · 2 comments
Labels
🐞bug Something isn't working
Milestone

Comments

@dongfangtianyu
Copy link
Contributor

Describe the bug
Could not find reference in parsed models, when components title is different from the name
for example :dongfangtianyu@add365f

To Reproduce

git remote add dongfang  [email protected]:dongfangtianyu/openapi-python-client.git
git fetch dongfang 
git checkout  dongfang/debug
task re

Output

Generating my-test-api-client
Warning(s) encountered while generating. Client was generated, but some pieces may be missing

WARNING parsing GET /test/model_title_diff_name within default.

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

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

Desktop (please complete the following information):

  • openapi-python-client version 0.8.0

Additional context

Problems may arise in: https://github.com/triaxtec/openapi-python-client/blob/main/openapi_python_client/parser/properties/__init__.py#L444

reference.class_name == "Page_AdminTodoOut_"
schemas.models == {
    "PageAdminTodoOut":  ModelProperty(....),
    ....
}
@dongfangtianyu dongfangtianyu added the 🐞bug Something isn't working label Mar 1, 2021
@dongfangtianyu
Copy link
Contributor Author

I have temporarily made the following modifications so that my work can continue:
https://github.com/triaxtec/openapi-python-client/blob/main/openapi_python_client/parser/properties/__init__.py#L311

schemas = attr.evolve(schemas, models={**schemas.models, prop.reference.class_name: prop})

to

schemas = attr.evolve(schemas, models={**schemas.models, prop.name: prop})

@dbanty
Copy link
Collaborator

dbanty commented Mar 3, 2021

This is definitely the same issue as in #300 , so it's on my radar to fix. Thanks for reporting, good to have an actual issue for this (and not just a PR that won't end up making it through).

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