bcgov / ckanext-bcgov

BC Data Catalogue source code, main ckan extension
http://catalogue.data.gov.bc.ca
GNU Affero General Public License v3.0
24 stars 23 forks source link

"Resource Storage Location" is a mandatory field yet a resource can be updated without this field specified. #481

Open dkelsey opened 6 years ago

dkelsey commented 6 years ago

ENV

CAD & CAT

This relates to #395

TESTCASE

EXPECTED

ACTUAL

jrods commented 6 years ago

PR #479 fixes the issue and gives a validator error when missing. However, there's no validation of the value itself. Meaning that value can be anything and not match the list of edc_vocabs that an editor would see in the webui.

jrods commented 6 years ago

@dkelsey one issue that may arise in testing for validating the actual value is validating the schema on update. Eg. is when an editor edits an old resource that uses a storage location from the old list, what would you like to happen?

~One option is to validate the old value with the current list and throw an error when an editor save, making them update the resource_storage_location.~

~The other option is to validate the incoming value for new resources only. This would prevent those potential errors in the first option due to the resource may still need to specify their old value.~

jrods commented 6 years ago

@dkelsey i've just been doing analysis on option 2 in my last comment, it looks like this option isn't possible due to the way ckan saves datasets & resources. When ckan saves a new resource, it goes through the update schema path, rather than create schema path.

~So, right now the first option i suggested is the only way to validate the resource storage location, I will have to see what happens when resources have old values for the storage location.~

jrods commented 6 years ago

@dkelsey more problems, looks like with option one, it fails silently with both the webui and api on datasets with invalid resource_storage_location.

So, the only option before applying the validation on the resource_storage_location field (and any other fields that are dependent on vocabs) is to migrate existing values to valid values. A strategy will be needed for this.

hleckenb commented 5 years ago

Existing dataset records are occassionally missing this information. Create solution to populate all existing resource metadata with a default = field entry has no meaning OR create an error to guide user to complete the field correctly OR automate where possible (e.g. BCGW).

hleckenb commented 5 years ago

@dkelsey over to you mate.

hleckenb commented 5 years ago

@dkelsey please investigate this ticket.