OpenAPITools / OpenAPITools/openapi-generator
[REQ] Python FastAPI Server Code Generator Library Mode
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the Python FastAPI server generator and the analogous delegatePattern or isLibrary options in the Spring and ASP.NET generators mentioned in the issue. Define how models and APIs should be emitted as a consumable library, then verify that regeneration leaves implementing application code separate and that the generator can publish the resulting package.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, python
- Domain
- api, backend, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100