output_validators not effecting package_extras not in database
- Dominant language
- Python
- Stars
- 102
- Forks
- 182
- PR merge metrics
- No merged PRs in 30d
Description
### CKAN Version
2.10.8
### Describe the Bug
When an extra in the `package_extra` database table is not populated/does not exist, `output_validator`s won't run on that extra field.
### Replicating the bug
**Input**:
Call `/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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.