csse-uoft / ckanext-udc

GNU Affero General Public License v3.0
1 stars 0 forks source link

Field-level validation on JSON Config object #25

Closed bgajdero closed 1 year ago

bgajdero commented 1 year ago

The JSON Config object, when uploaded, is varified as a valid JSON objecty, syntactically.

However, errors show up if a field or value is defined incorrectly. For example, in the following code, the "name" value "country label" has a space. It's saved correctly (as it's valid JSON) but fails when loaded by JavaScript on the screen. It fails with the error attached, and prevents any other JavaScript components form running: [{ "title": "Maturity Level 9 (Example)", "name": "maturity_level_9", "fields": [{ "name": "country label", "label": "Country", "type": "text", "short_description": "Country label", "long_description": "Country label for the dataset.", "category": "content" } }]

JavaScript Error on create/edit dataset screen: Screenshot 2023-03-22 at 10 59 04