flask-rest-jsonapi icon indicating copy to clipboard operation
flask-rest-jsonapi copied to clipboard

MethodViewType was removed for Flask 2.2.x

Open nbrinckm opened this issue 2 years ago • 4 comments

I'm not exactly aware, where to point to in the changelogs, but in an pull request from June they removed the MethodViewType class: https://github.com/pallets/flask/pull/4624

So the import of this class in https://github.com/miLibris/flask-rest-jsonapi/blob/master/flask_rest_jsonapi/resource.py#L12 will not work.

Are there any plans to make the flask-rest-jsonapi ready for usage in Flask 2.2 ?

nbrinckm avatar Aug 30 '22 11:08 nbrinckm

I tested with the latest flask version (2.2.2).

nbrinckm avatar Aug 30 '22 11:08 nbrinckm

I'm not exactly aware, where to point to in the changelogs, but in an pull request from June they removed the MethodViewType class: pallets/flask#4624

So the import of this class in https://github.com/miLibris/flask-rest-jsonapi/blob/master/flask_rest_jsonapi/resource.py#L12 will not work.

Are there any plans to make the flask-rest-jsonapi ready for usage in Flask 2.2 ?

You can amend resource.py. replace MethodViewType with type(MethodView)

p0562153 avatar Feb 27 '23 14:02 p0562153

Why hasn't the maintainer responded to this?

Seems it is still broken. This repo should probably get marked as archived.

python3 app.py
Traceback (most recent call last):
  File "/Users/toor/workspace/connexion/app.py", line 4, in <module>
    from flask_rest_jsonapi import Api, ResourceDetail, ResourceList, ResourceRelationship
  File "/Users/toor/workspace/connexion/venv/lib/python3.9/site-packages/flask_rest_jsonapi/__init__.py", line 3, in <module>
    from flask_rest_jsonapi.api import Api
  File "/Users/toor/workspace/connexion/venv/lib/python3.9/site-packages/flask_rest_jsonapi/api.py", line 12, in <module>
    from flask_rest_jsonapi.resource import ResourceList, ResourceRelationship
  File "/Users/toor/workspace/connexion/venv/lib/python3.9/site-packages/flask_rest_jsonapi/resource.py", line 12, in <module>
    from flask.views import MethodView, MethodViewType
ImportError: cannot import name 'MethodViewType' from 'flask.views' (/Users/toor/workspace/connexion/venv/lib/python3.9/site-packages/flask/views.py)
blinker==1.7.0
click==8.1.7
Flask==3.0.0
Flask-REST-JSONAPI==0.31.2
greenlet==3.0.3
importlib-metadata==7.0.1
itsdangerous==2.1.2
Jinja2==3.1.3
MarkupSafe==2.1.3
marshmallow==3.20.2
marshmallow-jsonapi==0.24.0
packaging==23.2
six==1.16.0
SQLAlchemy==2.0.25
typing_extensions==4.9.0
Werkzeug==3.0.1
zipp==3.17.0

jondkelley avatar Jan 11 '24 23:01 jondkelley

I used https://github.com/AdCombo/flask-combo-jsonapi and also fixed there methodviewtype

igieon avatar Jan 12 '24 08:01 igieon