Skip to content

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

Closed

Description

@dongfangtianyu

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  git@github.com: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(....),
    ....
}

Activity

  1. dongfangtianyu commented on Mar 1, 2021

    @dongfangtianyu
    ContributorAuthor

    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})
    
  2. dbanty commented on Mar 3, 2021

    @dbanty
    Collaborator

    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).

  3. added this to the 0.9.0 milestone on Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions