jfinkels / flask-restless

NO LONGER MAINTAINED - A Flask extension for creating simple ReSTful JSON APIs from SQLAlchemy models.
https://flask-restless.readthedocs.io
GNU Affero General Public License v3.0
1.02k stars 301 forks source link

X_serializer, X_deserializer ignored #609

Open gberrido opened 7 years ago

gberrido commented 7 years ago

Hello

I just noticed that the custom marshmallow schema passed to the api via the serialzer/deserializer arguments do not produce any change to the json data produced.

I just took the envelope example from the marshmallow doc and passed it into the create_api as de/serializer.

Can this be a bug in the 1.0b ? (I saw a diff from the 0.17 to 1.0b where the serializer part was reworked)

jfinkels commented 7 years ago

Hi @gberrido! I haven't tested marshmallow integration very thoroughly. Would you mind providing your code, ideally a minimal working example that demonstrates the issue you're having?

gberrido commented 7 years ago

Hello I have gathered all the code in the attached file. The JSON format produced by the serializer is supposed to match the API of the great tutorial by M. Grindberg (https://blog.miguelgrinberg.com/post/designing-a-restful-api-using-flask-restful) with the goal to have a 3rd version of server, build with flask-restless, compatible with the client in the tutorial's part 2.

Thanks again for the great work, your module is extremely useful.

rest-server-v4.zip

jfinkels commented 7 years ago

Hi @gberrido! Can you test your code on the development version of Flask-Restless? Specifically, you'll see that the APIManager.create_api() method now accepts a serializer_class keyword argument, in which you provide a subclass of DefaultSerializer (see https://flask-restless.readthedocs.io/en/latest/serialization.html).