http://flask.pocoo.org/docs/0.12/views/#method-views-for-apis demonstrates how to implement a get method on a MethodView that handles both the "get all" case (e.g. GET /todos/) as well as the "get one by id" case (e.g. GET /todos/1), and how to set up the url rules appropriately.
When I tried to adapt this to a simple class that extends flask_apispec.MethodResource, I got an error like this:
File ".../flask_apispec/paths.py", line 39, in argument_to_param
type_, format_ = CONVERTER_MAPPING.get(type(rule._converters[argument]), DEFAULT_TYPE)
KeyError: 'id'
The examples on https://flask-apispec.readthedocs.io/en/latest/usage.html only show how to set up a separate function outside the MethodResource to implement "get all" (namely list_pets()). Does flask-apispec not support combining the "get all" functionality into the MethodResource.get(...), method as Flask's "MethodViews for APIs" docs suggest? Thanks.
http://flask.pocoo.org/docs/0.12/views/#method-views-for-apis demonstrates how to implement a
get
method on aMethodView
that handles both the "get all" case (e.g. GET /todos/) as well as the "get one by id" case (e.g. GET /todos/1), and how to set up the url rules appropriately.When I tried to adapt this to a simple class that extends
flask_apispec.MethodResource
, I got an error like this:The examples on https://flask-apispec.readthedocs.io/en/latest/usage.html only show how to set up a separate function outside the MethodResource to implement "get all" (namely
list_pets()
). Does flask-apispec not support combining the "get all" functionality into theMethodResource.get(...)
, method as Flask's "MethodViews for APIs" docs suggest? Thanks.