swagger-api / swagger-api/swagger-codegen

[python] Adding support for python FastAPI as server stub and SQLAlchemy ORM

Open
#11,160 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Hello, I was wondering if there are any ideas or plans to implement a new server stub option for python that would rely on FastAPI. This would be an alternative to the current python server stub using python Flask and zalando/connexion.

And I was wondering if this could also use SQLAlchemy ORM (object relational mapper) to handle models and databases. Because I think this lacks the current python server stub.

Swagger-codegen version

3.0.27

Related issues/PRs

My question is related to this How to properly initialize Connexion and SQLAlchemy in Flask generated main.py, and more precisely related to this comment.

Summary: the Swagger-codegen python flask server stub models are very different from the official zalando/connexion SQLAlchemy ORM example. And I don't understand why and how to use the Swagger-codegen models and nor can I find real life examples of a python flask server (using DB) and generated with Swagger-codegen.

Suggest a fix/enhancement

FastAPI is gaining much popularity in the Python community and is under active development. And I find that the current swagger codegen python server stub using python Flask and zalando/connexion lack the support for ORM and DB support with SQLAlchemy.

Either enhance current python server stub (or explain to me how it works), or start fresh with FastAPI.

However if we forget about models and DB support, I have to say that using Flask + zalando/connexion is a nice idea.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading related issue #7307 and comparing the current Python Flask/Connexion server stub with the linked Connexion SQLAlchemy example. Clarify whether the project should enhance the existing stub or add a FastAPI option, including the expected ORM and database support. Done requires an agreed scope and an implemented, documented server-stub approach.

Written by the indexing model from the issue text.

Assessment

Tech stack
fastapi, flask, python, sqlalchemy
Domain
api, backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.