jmcarp / flask-apispec

MIT License
655 stars 156 forks source link

Breaking Changes in webargs 6.0.0b1 (pre-release) #176

Closed c-kruse closed 4 years ago

c-kruse commented 4 years ago

Hello, just ran into this by accident and wanted to be sure this landed on your radar. Webargs has introduced a backwards-incompatible v6 pre-release. https://webargs.readthedocs.io/en/latest/changelog.html#b1-2020-01-06

You may want to pin webargs to <6.0.0 until you come up with a more thoughtful approach.

To Recreate

Example flask app:

from flask import Flask
from flask_apispec import use_kwargs
from marshmallow import fields

app = Flask(__name__)

@app.route('/')
@use_kwargs({'category': fields.Str(), 'size': fields.Str()})
def get_pets(**kwargs):
    return []

if __name__ == "__main__":
    app.run()

Dependencies: (requirements.txt)

apispec==3.2.0
Click==7.0
Flask==1.1.1
flask-apispec==0.8.5
itsdangerous==1.1.0
Jinja2==2.10.3
MarkupSafe==1.1.1
marshmallow==3.3.0
six==1.13.0
webargs==6.0.0b2
Werkzeug==0.16.0

Error:

 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
[2020-01-07 14:46:35,733] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/Users/christiankruse/Workspace/flask-apispec-webargs/.venv/lib/python3.8/site-packages/flask/app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/christiankruse/Workspace/flask-apispec-webargs/.venv/lib/python3.8/site-packages/flask/app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/christiankruse/Workspace/flask-apispec-webargs/.venv/lib/python3.8/site-packages/flask/app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/christiankruse/Workspace/flask-apispec-webargs/.venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/Users/christiankruse/Workspace/flask-apispec-webargs/.venv/lib/python3.8/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/christiankruse/Workspace/flask-apispec-webargs/.venv/lib/python3.8/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/christiankruse/Workspace/flask-apispec-webargs/.venv/lib/python3.8/site-packages/flask_apispec/annotations.py", line 118, in wrapped
    return wrapper(*args, **kwargs)
  File "/Users/christiankruse/Workspace/flask-apispec-webargs/.venv/lib/python3.8/site-packages/flask_apispec/wrapper.py", line 32, in __call__
    response = self.call_view(*args, **kwargs)
  File "/Users/christiankruse/Workspace/flask-apispec-webargs/.venv/lib/python3.8/site-packages/flask_apispec/wrapper.py", line 46, in call_view
    parsed = parser.parse(schema, locations=option['kwargs']['locations'])
TypeError: parse() got an unexpected keyword argument 'locations'
127.0.0.1 - - [07/Jan/2020 14:46:35] "GET / HTTP/1.1" 500 -
jtruty commented 4 years ago

Got the same error and spent far too long debugging it.

c-kruse commented 4 years ago

Looks like webargs released 6.0.0 yesterday! This is no longer just an issue with a pre-release package. Anyone installing flask-apispec without an explicit pip install "webargs<6.0.0" will run into this issue.

sloria commented 4 years ago

flask-apispec 0.8.6 restricts the webargs version to <6.0. I'll open a new issue to fix compatibility with >=6.0