inveniosoftware / invenio-records-rest

Invenio records REST API module.
https://invenio-records-rest.readthedocs.io
MIT License
4 stars 63 forks source link

global: refactor serializers #166

Closed nharraud closed 6 years ago

nharraud commented 6 years ago

Signed-off-by: Nicolas Harraudeau nicolas.harraudeau@cern.ch

nharraud commented 6 years ago

@lnielsen this PR refactors the MarshmallowSerializer as a Mixin. If somebody wants to have a serializer without schemas they can implement their own transformation mixin. I can also transform all the other serializers as mixin.

The serializers still exist, they subclass all the necessary mixins. I transformed the JSON serializer as a mixin too. I can do the same for the other serializers if you want.

The classes should be mostly backward compatible.

Note that I also modified the link_factory use. It now receives all the parameters from the serializer. This avoids a problem we face in B2SHARE were we need the record metadata in order to generate some links. I think there is the same problem in Zenodo.

nharraud commented 6 years ago

@slint I modified the create_blueprint function in order to wrap any old-signature links_factory. Can you take a look?