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

[BUG] Python client docs - missing import when using nested objects #10279

Closed
4 of 6 tasks
johnnyaug opened this issue Aug 27, 2021 · 3 comments
Closed
4 of 6 tasks

[BUG] Python client docs - missing import when using nested objects #10279

johnnyaug opened this issue Aug 27, 2021 · 3 comments

Comments

@johnnyaug
Copy link

johnnyaug commented Aug 27, 2021

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When generating python docs where the parameters are nested objects, their classes are not imported.

Example in the pet store docs:
https://github.com/OpenAPITools/openapi-generator/blob/master/samples/client/petstore/python/docs/PetApi.md#find_pets_by_tags

In this file, Tag should be imported.

openapi-generator version

latest master branch

OpenAPI declaration file content or url

In the Petstore example https://github.com/OpenAPITools/openapi-generator/blob/master/samples/yaml/pet.yml,
Pet has a $ref to Tag.

Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix
@spacether
Copy link
Contributor

spacether commented Oct 4, 2022

Nested imports were fixed in #13137

  • in python-experimnetal v6.1.0 and later
  • and in python in v6.2.0 and later

For the listed case, the Tag schema is defined inline in the endpoint, and it is generated as a Schema class in the endpoint module here: https://github.com/OpenAPITools/openapi-generator/blob/master/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_tags/get.py#L59

And the Pet model imports the Tag model here:

@feluelle
Copy link
Contributor

I am still seeing this with python-nextgen 6.5.0 and 6.6.0-SNAPSHOT. Is this only fixed in python?

@spacether
Copy link
Contributor

Yes. Python-nextgen did not exist when this ticket was created and closed. Please make a separate ticket for python-nextgen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants