-
Notifications
You must be signed in to change notification settings - Fork 180
Description
Hi all,
I have encountered a recurring issue when using ckanext-scheming to define custom dataset and resource schemas. When I separate my dataset and resource schemas into different YAML files and configure them using scheming.dataset_schemas and scheming.resource_schemas in the CKAN config, I consistently get a KeyError: 'resource_fields' error when creating or editing datasets.
What I Did
My sddi_dataset.yaml defines dataset_fields and the resource_type field.
I placed resource schemas (e.g. dataset_resource_schema.yaml) in a separate file, configured like this in ckan.ini:
ini
scheming.dataset_schemas = ckanext.scheme_sddi:sddi_dataset.yaml
scheming.resource_schemas = ckanext.scheme_sddi:schemas/dataset_resource_schema.yaml
My resource schema file looks like this:
yaml
scheming_version: 2
resource_type: dataset
resource_fields:
- field_name: data_format
label: Data Format
When using this setup, I receive:
vbnet
KeyError: 'resource_fields'
at /usr/local/lib/python3.10/site-packages/ckanext/scheming/plugins.py during package/resource creation.
What Works
If I combine both dataset and resource fields in a single schema YAML file and use only scheming.dataset_schemas, everything works correctly and no errors occur.
Expected
I expect that when using scheming.resource_schemas with multiple separate resource schema files, CKAN should load the resource fields dynamically without error, as described in the ckanext-scheming documentation.
My Question / Request
Is there something I am missing in the configuration to allow dynamic resource schemas to load correctly?
Is this a bug or an undocumented limitation?
If this is intended, could the documentation clarify the requirements for resource_type fields, and how the resource schemas are loaded/applied?
If possible, can you provide a minimal working example for multiple resource schemas?