New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recommended alternatives to Flask-RESTful components #883
Comments
|
Ah yes, webargs. That's what I had meant to put down for request parsing but forgot it was a separate package from marshmallow, thanks. |
@joshfriend Can you please mention what benefit did you get by using MethodView over Resource? or what issues you had with Resource that MethodView isnt having ? |
I don't like Really the only thing I did want was ability to construct flask I also wrote a very small @bp.endpoint("foo/bar")
class FooBarResource(MyResource):
pass but that was also very optional and only took like 5 lines of code |
can you point out the differences in error handling in both? |
@joshfriend thanks for your update, it was a pleasure to use Flask-RESTful in my projects :) |
I found flask-classful also a very good replacement for |
@jeryini can you speak to that a bit? I'm looking through my options and I think flask-classful is the best fit. My reason is because I need something super un-opinionated right now. |
Hello @aaj! Yes I found flask-classful a very good replacement for
|
For me the best alternative to flask-restful has been flask-restplus, which is now flask-restx |
A lot of flask-restplus/flask-restx is a direct copy of flask-restful, which is probably why you like it so much as an alternative 😉. |
I was wondering about that. Now it is clear why the docs are so similar. 🙄 |
flask-restplus wanted to replace request parsing with marshmallow/webargs but never did it, mainly due to lack of time/motivation and not wanting to lose backwards compatibility. A user provided an example patching flask-restplus to use marshmallow but that never made it to the core. flask-restx didn't do it either. This lack of marshmallow integration is the reason we wrote flask-smorest. It is marshmallow based, uses webargs for request parsing and apispec for doc generation. |
Use Flask's `MethodView`, instead. References: flask-restful/flask-restful#883
As some folks have noticed, I don't work on this much anymore. This is mostly because I've found alternatives that I like better than what's provided here, so I don't actively use Flask-RESTful for any of my projects anymore.
Here's what I recommend for replacements in TL;DR form:
Resource
→ Regular flaskMethodView
reqparse
→ webargs/Marshmallowfields
→ Flask-Marshmallowutils.cors
→ Flask-CORSutils.crypto
→ Nobody knows what this even doesMarshmallow in particular is a worthwhile change because it does so many things better than
fields
orreqparse
:Regarding
Resource
I found that I did not need any of the wrapping that it andApi
do. JustMethodView
from Flask was plenty for any use case I found.The text was updated successfully, but these errors were encountered: