inveniosoftware / rfcs

RFCs for Invenio.
https://rfcs.readthedocs.io
4 stars 15 forks source link

[Proposal] RFC: JSONSchema resolution and registry #41

Closed lnielsen closed 3 years ago

lnielsen commented 3 years ago

Motivation

It is hard for users to understand how to correctly set the JSONSCHEMA_HOST configuration variable, and how a JSONSchema in the source code is linked up with a record. This RFC proposes a method to get rid of the JSONSCHEMA_HOST variable so that users (admins/instance developers) have less configuration to do.

In addition, the JSONSchema validation in Invenio-Records is complicated to understand, partially because the Invenio-JSONSchema builds a registry where the id property in a JSONSchema does not match the URL you need to use in records in order to validate according to that schema. In addition, the current method leaves the possiblity that a schema can be fetched remotely, meaning that backend code is making requests to potentially unknown services.

Summary

The RFC proposes to extend Invenio-Records with an optional feature to inject a custom RefResolver and to extend the existing registry in Invenio-JSONSchema with an function to provide a schema store/registry to the RefResolver. This is to build an easier to understand JSONSchema validation and loading.

https://codimd.web.cern.ch/x9wZmPRsQoO8SrZkl57PlQ

lnielsen commented 3 years ago

Written in #42