OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.3k stars 6.45k forks source link

[BUG] missing base classes `*_api_base.py` for `python-fastapi` server templates #16200

Open LarsParTec opened 1 year ago

LarsParTec commented 1 year ago

Bug Report Checklist

Description

I try to reproduce the minimal pet store example for the python-fastapi template in this public repository. As I understand, each mustache template generates one or more Python files, see examples in the table below.

mustache template generated code
api.mustache pet_api.py, store_api.py, user_api.py
base_api.mustache pet_api_base.py, store_api_base.py, user_api_base.py

As can be seen here, six classes are supposed to be generated: 3 *_api.py and 3 *_api_base.py.\ As can be seen in my test run, only the 3 *_api.py are generated. The 3 *_api_base.py classes are missing.

Expected behaviour: Generation of six Python files *_api.py and *_api_base.py. Actual behaviour: Generation of only three Python files *_api.py. The three files *_api_base.py are missing.

openapi-generator version

6.6.0 on macOS 13.4.1

OpenAPI declaration file content or url
Generation Details

See this public repository and above.

Steps to reproduce

Run the generate.sh script with default templates.

Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/issues/16192

Suggest a fix

None.

wing328 commented 1 year ago

I couldn't repeat the issue in my end as I can see for example src/openapi_server/apis/pet_api_base.py was generated successfully and it's not empty:

Screen Shot 2023-07-31 at 4 37 08 pm