inveniosoftware / flask-resources

REST APIs for Flask
https://flask-resources.readthedocs.io
MIT License
3 stars 21 forks source link

responses: rename module and refactor handlers structure #51

Closed ppanero closed 4 years ago

ppanero commented 4 years ago

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 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:

As for the naming... All modules (loaders, serializers, resources) are called in plural, however response is singular. Therefore, it got renamed.