[ckan-dev] Custom fields that are arrays or objects with fields

Ian Ward ian at excess.org
Thu Oct 30 13:06:18 UTC 2014


It is possible to have custom fields with values that appear as JSON
objects or lists. In ckanext-fluent I return and accept JSON objects
with language codes as keys:
https://github.com/open-data/ckanext-fluent

You need to think about how you're going to handle form inputs as well
as the "ideal" json types if you want your fields to be editable
through the normal ckan interface.

I will be starting another extension that will represent repeated text
fields as JSON lists of strings. Currently I'm storing that kind of
thing as delimited text, but it's not a very nice solution.

Ian

On Wed, Oct 29, 2014 at 5:19 PM, Renato Guevara
<guevara.renato at gmail.com> wrote:
> Is it possible to add custom fields that can be an array of values and/or is
> it possible to add custom fields that are objects with field-value mappings.
>
> For example,
>
> I'd like to add the following
>
> queryLanguage: [ sql, sparql]
>
> or
>
> cat: {
>           type: animal,
>           legs: four
>        }
>
> It seems that the only type of field I can add is a simple key-value pair
> where the value is one string.  There is also a concept of vocabulary and
> tags, but it also seems that the field that has a tag only holds one tag and
> not multiple.
>
> Any help would be very much appreciated.
>
> Thanks!
>
> Renato Guevara
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>



More information about the ckan-dev mailing list