Skip to content

output_validators not effecting package_extras not in database #443

@mackeynichols

Description

@mackeynichols

CKAN Version

2.10.8

Describe the Bug

When an extra in the package_extra database table is not populated/does not exist, output_validators won't run on that extra field.

Replicating the bug

Input:
Call <our_ckan>/api/3/action/package_show?id=id123 with the following body

  • package id123 doesnt have a value for "collection_method" in the package_extra database table
  • package id123 is of dataset_type: "dataset"

Expected Output:

  • "collection_method" field is shown as collection_method: null

Actual Output:

  • "collection_method" field is not shown in package_show response

Configurations

I am using this YAML to configure scheming:

scheming_version: 2
dataset_type: dataset
about: A reimplementation of the default CKAN dataset schema
about_url: http://github.com/ckan/ckanext-scheming

dataset_fields:
  - field_name: title
    label: Title
    required: true

  - field_name: url
    label: URL
    preset: dataset_slug
    form_placeholder: eg. my-dataset
    required: true

  - field_name: collection_method
    label: Collection Method
    output_validators: default_to_none

resource_fields: 
  - field_name: title
    label: Title
    required: true

  - field_name: url
    label: URL
    preset: dataset_slug
    form_placeholder: eg. my-dataset
    required: true

It references this custom validator:

def default_to_none(value):
    if value:
        return value
    else:
        return None

I have been refreshing the SOLR index before and after making the package_show call.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions