inveniosoftware / flask-resources

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

Make Resource methods not have to return a tuple #55

Open fenekku opened 4 years ago

fenekku commented 4 years ago

Because our MethodViews use this pattern:

        return self.response_handler.make_item_response(
            *self.resource.create(*args, **kwargs)
        )

self.resource.create needs to return a tuple. We should mimic Flask further and allow single value OR tuple.

Without this change, the developer needs to return a tuple in their Resource method which might lead to code like:

def get(self):
    return [],

just to satisfy that need. The comma could subsequently be deleted by accident and subtly break the code.