ckan / ckan/ckanext-scheming

Support list of dicts

Open
#75 10 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
102
Forks
182
PR merge metrics
No merged PRs in 30d

Description

I want to accept arbitrary dicts for a field that i defined in a scheme. It seems that CKAN tries to apply some kind of sub-schema if it encounters a list of dicts. Is it possible to define such sub-schemas with this extension?
And if the fields are not known, all the data is [put into the key "__junk"](https://github.com/ckan/ckan/blob/0f145a54629287a6f7764b8fd73963bda62260ef/ckan/lib/navl/dictization_functions.py#L147-L149) as a flattened dict.

What I ended up doing is writing my own validator that gets the values out of the __junk, but I'm pretty sure this is a bad solution (see here for details: https://github.com/ogdch/ckanext-switzerland/blob/421de6c546462f0ac5764f93064d68d285addda2/ckanext/switzerland/validators.py#L39-L62).

Any ideas how to handle this?

Contributor guide

No contributing guide indexed for this repository

Research direction

Read CKAN's dictization_functions.py around the linked __junk handling, then compare it with the custom validator in ckanext/switzerland/validators.py. Determine how schema-defined fields should preserve arbitrary dictionaries inside lists without flattening unknown keys, and define tests that demonstrate the intended behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.