inveniosoftware / training

Invenio v3 Training Material
https://training.readthedocs.io
MIT License
40 stars 45 forks source link

JSON schema validation #41

Open ltalirz opened 5 years ago

ltalirz commented 5 years ago

While playing around with @hjhsalo, we noticed that the default records data model coming out of the invenio-cookiecutter-instance actually does not use the provided JSON schema for validation of incoming records.

We also noticed that the new Authors data model was using the JSON schema for validation. Thanks to @zzacharo for pointing out the hack responsible for this https://github.com/inveniosoftware/training/blob/master/08-data-models-from-scratch/author_module/my_site/authors/api.py#L26

Since the introduction to data models in invenio starts with the JSON schema, I believe the natural expectation of a new user is that this JSON schema will be used for validation (otherwise why are we writing it?). I would suggest to enable validation based on the JSON schema for the records data model in invenio-cookiecutter-instance