flask-rest-jsonapi
flask-rest-jsonapi copied to clipboard
Non-JSON MIME types
trafficstars
I realise this has been discussed briefly at #13. However, we don't yet have a good solution.
The problem is this: I want my API to input and output data in both CSV and JSON format. When dealing with JSON I of course want to use the JSON API spec, and flask-rest-jsonapi should deal with that perfectly. The problem is, I don't want to duplicate all my code to also support CSV. I want the URLs, the schemas, and the models to be exactly the same as the JSON API. The only difference is that I want a hook that runs before loading and after dumping JSON data, when the Accept/Content Type header is csv, in order to convert to/from JSON. Is this possible?