Closed cedricbonhomme closed 3 years ago
flask_restless_ng
is intended to be a replacement for flask_restless
, and not intended to be used simultaneously. In fact, they might conflict with each other.
Why do you need to import the old one?
I confirm, they conflict ;-)
I am not sure I will be able to provide the exact same API to the clients with Flask-Restless-ng. By clients, I mean real users and also an Angular application. Or it will be a lot of work to achieve this. This is why for the moment I created the API v1.1, which might replace the API v1. I hope soonish.
I think I will end up forking flask-restless and just call it Flask-RestMoreOrLess with some fixes for recent Flask-SQLalchemy version.
Version 1.0.* of Flask-Restless-NG should be fully API compatible with Flask-Restless version 1.0.0b1
Which version of Flask-Restless are you trying to replace?
The version 0.17.0, just before 1.0.0b1 :-(
This is what I had to change in the Jinja template of the Flask application (just as example): https://github.com/CASES-LU/MOSP/commit/6bc38d826c29e4c6bf6da295776613955a543529#diff-c2f855a51fb43b7c60868892f07b6786d1071eacf7b7ad66d193e1be0f4e70bcL79-L92
For example it seems 'objects' is now 'data', in the answer. Also I need to use these "attributes" in order to access to the attributes of the object. I would like to remove this additional level in the result. Same for the "relationships" attribute in the result.
Actually, it works well for me with Flask-Restless-ng. But the structure of the result is quite different. The clients will have to change their code. Also, what changed is the information in the "meta" (or "metadata") about the pagination, number of results, etc.
I guess, the serialization could help mehere. If I want the exact same structure (and remove the "attribute" and "relationships" keys).
Actually I am using serialization with Flask-restx in the same project (API v2). Maybe I should try to share the serialization between the APIs.
An an other example (other project), this query:
https://open-source-security-software.net/api/v1/project?results_per_page=50&q={"filters":[{"name":"licenses","op":"any","val":{"name":"license_id","op":"eq","val":"Apache-2.0"}}]}
(it is generated when someone clicks on a Chart.js chart here...) This is pure Falsk-restless filters, without any customization. These are things I did not have tested yet. But fine, I will see.
I close this issue because it is out of topic. I have the answer about the subject.
I will continue to work in order to fully replace Flask-restless.
I see now. Starting version 1.0 Flask-Restless
has switched to JSON API
format (https://jsonapi.org/) so yes, the structure has changed completely. Flask-Restless-NG
forks from 1.0.0b1
OK, on PyPi Flask-Restless is stuck at 0.17.0 . I understand now this point.
OK, thanks ! It's just more work...
I managed to solve the issues I had recently (#9). Thank you.
I realize it will be more work than planed to replace my APIv1 based on Flask-Restless in a way that the clients won't notice the changes. So I ended up creating a APIv1.1: https://github.com/CASES-LU/MOSP/tree/flask-restless-ng/mosp/web/views/api (the API v2 is based on flask_restx...).
So, my issue now is that these two dependencies (Flask-Restless and Flask-Restless-ng) must be imported with the same name.
Ofc, I can not do stupid things like:
Would you have an idea to solve this issue ? Maybe I can just put the source code of the un-maintained Flask-Resless in my code or keep my own fork. But I would prefer another solution.