inspirehep / inspire-dojson

INSPIRE-specific rules to transform from MARCXML to JSON and back.
GNU General Public License v3.0
3 stars 18 forks source link

Is storing the absolute URLs in $refs a good idea? #57

Open jacquerie opened 7 years ago

jacquerie commented 7 years ago

From @jmartinm on July 5, 2016 14:50

At the moment, as far as I can see, both in the database and in ElasticSearch the $refs between records are expressed as absolute URLs. Talking to @david-caro the question came up of how, for example, could one load a dump of production locally and still have it working (if the references are absolute).

I have seen a couple of 'related' issues on Invenio:

https://github.com/inveniosoftware/invenio-records/issues/117 https://github.com/inveniosoftware/invenio-jsonschemas/issues/23

This same problem might happen, for instance, the moment we switch from labs.inspirehep.net to inspirehep.net, what will we do with the $refs?

Copied from original issue: inspirehep/inspire-next#1295

jacquerie commented 7 years ago

From @jmartinm on July 6, 2016 12:23

Talking today IRL, it seems indeed it might not be a good idea. We can instead store a relative path and when presenting the record in the API convert into absolute in the serializer.

jacquerie commented 7 years ago

The helper I introduced in #1680 to convert between schemas and pid_types works as well on relative URLs: https://github.com/inspirehep/inspire-next/pull/1680/files#diff-914d1730de5ed34ec6f4a26aee927dfbR53