It was noticed when making the response for the search GET action on the ListView, it requires the old ListResponse while the create POST requires the old ItemResponse. The ListView was only getting the ListReponse class.
Solution
Merge both response classes in one, which will have to methods: make_item_response and make_list_response.
Why/Motivation
Both ItemResponse and ListReponse:
Have the same constructor
Use the same serializer for a view, i.e. even if only calling one of their functions (list or item) depending on which response class is calling the serializer is the same per view.
Serializers follow this pattern and is cleaner (One serializer with serialize_obj and serialize_obj_list methods).
As for the naming... All modules (loaders, serializers, resources) are called in plural, however response is singular. Therefore, it got renamed.
Replaces https://github.com/inveniosoftware/flask-resources/pull/50 Closes https://github.com/inveniosoftware/flask-resources/issues/48
It was noticed when making the response for the search
GET
action on theListView
, it requires the oldListResponse
while the createPOST
requires the oldItemResponse
. TheListView
was only getting theListReponse
class.Solution
Merge both response classes in one, which will have to methods:
make_item_response
andmake_list_response
.Why/Motivation
Both
ItemResponse
andListReponse
:serialize_obj
andserialize_obj_list
methods).As for the naming... All modules (loaders, serializers, resources) are called in plural, however response is singular. Therefore, it got renamed.