You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently the server stub generated by OpenAPI Generator for Python FastAPI generator only provides support for generating complete server where we need to modify the generated code. The Spring or ASP.NET server generators have options such as delegatePattern or isLibrary in the configuration file which allows us to generate only the interfaces which can be implemented through a concrete class, which lets us easily update the OpenAPI schema and generate new interfaces without modifying existing code by hand.
Describe the solution you'd like
An option to generate the models and APIs as a library which can be published to a package repository and can be consumed by the implementing application.
Describe alternatives you've considered
We are currently updating the generated code through a bash script but that feels like a monkey patching rather than a solution itself as the script depends on the structure of the generated file, which too will change when changing the OpenAPI schema. Implementing a robust solution on the generator itself should be the way to go.
I think this is already possible with the FastAPI generator? For me at least it generates a default_api.py file with the API endpoints and this delegates to a default_api_base.py which just has stubs that you subclass and override. I've been putting this implementation subclass in a separate project from the generated code with no problems. As long as your subclass is imported somewhere when the server starts up the FastAPI implementation should find it and invoke it.
Is your feature request related to a problem? Please describe.
Currently the server stub generated by OpenAPI Generator for Python FastAPI generator only provides support for generating complete server where we need to modify the generated code. The Spring or ASP.NET server generators have options such as delegatePattern or isLibrary in the configuration file which allows us to generate only the interfaces which can be implemented through a concrete class, which lets us easily update the OpenAPI schema and generate new interfaces without modifying existing code by hand.
Describe the solution you'd like
An option to generate the models and APIs as a library which can be published to a package repository and can be consumed by the implementing application.
Describe alternatives you've considered
We are currently updating the generated code through a bash script but that feels like a monkey patching rather than a solution itself as the script depends on the structure of the generated file, which too will change when changing the OpenAPI schema. Implementing a robust solution on the generator itself should be the way to go.
cc: @multani @fa0311 @krjakbrjak @tomplus @cbornet
The text was updated successfully, but these errors were encountered: