[python-fastapi] Added a base class for the actual implementation (#14470)

It is very difficult to "merge" the changes, made by code generation,
and the changes, made by developers. It would be very useful to
separate the generated code and the code written by developers. In
addition this would remove the necessity to track the generated code.
Pyhton (since 3.6) has a hook, __init_subclasses__, that could be used
to solve exactly this problem.
The classes from *_base.py should be implemented in an ns package that is specified
by the additional parameter ("-p fastapiImplementationPackage=example_name").

Signed-off-by: Nikita Vakula <programmistov.programmist@gmail.com>
This commit is contained in:
Nikita Vakula
2023-05-26 02:58:39 +02:00
committed by GitHub
parent b94952b3b7
commit 3db7169959
13 changed files with 307 additions and 21 deletions

View File

@@ -9,8 +9,11 @@ requirements.txt
setup.cfg
src/openapi_server/apis/__init__.py
src/openapi_server/apis/pet_api.py
src/openapi_server/apis/pet_api_base.py
src/openapi_server/apis/store_api.py
src/openapi_server/apis/store_api_base.py
src/openapi_server/apis/user_api.py
src/openapi_server/apis/user_api_base.py
src/openapi_server/main.py
src/openapi_server/models/__init__.py
src/openapi_server/models/api_response.py