jmcarp / jmcarp/flask-apispec

Marshaling Without a Schema

Open
#65 1 comment 5 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
652
Forks
151
PR merge metrics
No merged PRs in 30d

Description

Currently running v0.4.0 and noticing that if you attempt to pass `None` as the first argument to `marshal_with`, you receive a 500 response. Here's the minimum example to reproduce:

```Python
import flask
import flask_apispec

application = flask.Flask(__name__)

BLUEPRINT = flask.Blueprint('users', __name__, url_prefix='/users')

class Resource(flask_apispec.MethodResource):

@flask_apispec.marshal_with(None, 204, 'No Content')
def get(self):
return None, 204

BLUEPRINT.add_url_rule('',
endpoint='get',
view_func=Resource.as_view('get'),
methods=['GET'])

application.register_blueprint(BLUEPRINT)
```

Here's the stack trace that I'm seeing.
```
Traceback (most recent call last):
File "/Users/gkadillak/.virtualenvs/temp-api/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/Users/gkadillak/.virtualenvs/temp-api/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/gkadillak/.virtualenvs/temp-api/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/gkadillak/.virtualenvs/temp-api/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/gkadillak/.virtualenvs/temp-api/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/gkadillak/.virtualenvs/temp-api/lib/python2.7/site-packages/flask/views.py", line 84, in view
return self.dispatch_request(*args, **kwargs)
File "/Users/gkadillak/.virtualenvs/temp-api/lib/python2.7/site-packages/flask/views.py", line 149, in dispatch_request
return meth(*args, **kwargs)
File "/Users/gkadillak/.virtualenvs/temp-api/lib/python2.7/site-packages/flask_apispec/annotations.py", line 117, in wrapped
return wrapper(*args, **kwargs)
File "/Users/gkadillak/.virtualenvs/temp-api/lib/python2.7/site-packages/flask_apispec/wrapper.py", line 28, in __call__
return self.marshal_result(unpacked, status_code)
File "/Users/gkadillak/.virtualenvs/temp-api/lib/python2.7/site-packages/flask_apispec/wrapper.py", line 49, in marshal_result
output = schema.dump(unpacked[0]).data
AttributeError: 'dict' object has no attribute 'dump'
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.