Replies: 1 comment 6 replies
-
Hi Steven, this project will never exist without the marshmallow-code projects you created, thank you! In a word, I try to provide an elegant (act as a framework, no need to instantiate additional extension object) and simple (more automation support for OpenAPI) solution for creating web APIs with Flask. Here is a quick summary of the differences: The differences between APIFlask and similar projectsA natural order of view argumentsBy acting as a framework on top of Flask, it can overwrite the way Flask passes path args to view functions from keyword arguments to positional arguments. Assume a view like this: @app.get('/<category>/articles/<int:article_id>')
@input(ArticleQuerySchema, location='query')
@input(ArticleInSchema)
def get_article(category, article_id, query, data):
pass With APIFlask, you can accept the arguments in a natural way (from left to right, from top to bottom): def get_article(category, article_id, query, data) With APIFairy, Flask-Smorest, or Webargs, you have to do this: def get_article(query, data, category, article_id) I achieve this by overwriting Flask's Route shortcutsAPIFlask added some route shortcuts ( P.S. I proposed to add these to Flask itself, it finally supported in Flask with pallets/flask#3907. More automation for OpenAPI generatingI tried to add more automation support in APIFairy (miguelgrinberg/APIFairy#10) but failed. Besides adding an auto summary for the view function, APIFlask also does the following:
These behaviors can be changed with related configurations. More features compare with APIFairyI'm not very familiar with Flask-RESTy, Flask-RESTx, and Flask-Rebar. Compare to APIFairy (it seems similar to Flask-Smorest) I added these features in APIFlask:
The differences between APIFlask and FastAPII have to admit, I know little about FastAPI other than the introduction on its README. The differences I know so far:
I will try to learn more about FastAPI, then I will update this section. Update: Added a new chapter based on the summary above (Comparison and Motivations). |
Beta Was this translation helpful? Give feedback.
-
Nice work on this! I'm curious to hear about the motivations behind apiflask. What gaps does it fill that existing frameworks don't? I'd be interested to see a comparison with similar projects like apifairy, fastapi, flask-smorest, flask-resty, flask-restx, flask-rebar, etc.
Beta Was this translation helpful? Give feedback.
All reactions