caltechlibrary / caltechdata_api

Python library for using the CaltechDATA API
Other
10 stars 2 forks source link

Add error checking in customize_schema_rdm #23

Open tmorrell opened 5 months ago

tmorrell commented 5 months ago

It would be nice if this library implemented some checks to ensure that the required CaltechDATA fields are included in the metadata. This would allow us to provide cleaner error messages to the user.

This could be implemented as a new function in https://github.com/caltechlibrary/caltechdata_api/blob/main/caltechdata_api/customize_schema.py, which could then be called here https://github.com/caltechlibrary/caltechdata_api/blob/46e05ab9728510860fae5ad94b819cf5f04d1fce/caltechdata_api/customize_schema.py#L137

A minimal example would be to check that 'types' and 'resourceTypeGeneral' are present.

Next is checking for title, publication data, and creators

It could also check the structure of the json (That there isn't an array for types, for example)