inveniosoftware / invenio-records-rest

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

Marshmallow schema and field updates for PID and other helpers #234

Closed ppanero closed 5 years ago

ppanero commented 5 years ago

Fixes: https://github.com/inveniosoftware/invenio-records-rest/issues/232 Fixes: cookiecutter-invenio-instance#97 In order to use it the loader should be overwritten with:

record_loaders={
            'application/json': ('invenio_records_rest.loaders:json_pid_checker')
        },

And add the PID attribute name on the environment / config file:

[ INVENIO_ ]RECORDS_REST_PID_ATTR_NAME = 'control_number'

For the code:

For the tests:

Small punctualization: In order to follow the naming convention of this repo/other invenio repos, shouldn't the file be named test_loader_marshmallow instead of test_marshmallow_loader (e.g. check the serializers).

ppanero commented 5 years ago

@slint The changes are missing the tests:

Lastly and for consistency the name of ``test_marshmallow_loader.py should be changed to test_loader_marshmallow.py.

Code has been tested manually in my application and works as desired.

slint commented 5 years ago

I would say, let's postpone until https://github.com/inveniosoftware/cookiecutter-invenio-instance/pull/92 is merged, so that it's tested on the cookiecutter-invenio-instance as well

ppanero commented 5 years ago

@slint the cookiecutter PR has been merged, I am going to test it. Just that I cannot put myself as a reviewer :rofl:

ppanero commented 5 years ago

Tested. Also closes https://github.com/inveniosoftware/cookiecutter-invenio-instance/issues/97